Revision 9c1b18d0-2cf0-4f2f-aed5-c3d89528bd14 - Code Golf Stack Exchange

#Java 7, <s>231</s> <s>193</s> <s>185</s> <s>122</s> 103 bytes

 int c(char[]s){return s.length==5&&(s[1]-s[0])*(s[3]-s[2])<0&(s[2]-s[1])*(s[4]-s[3])<0&s[4]==s[0]?1:0;}

-38 bytes thanks to *@dpa97* for reminding me to use `char[]` instead of `String`. 
-63 bytes thanks to *@KarlNapf*'s derived formula.

**193 bytes answer:**

 int c(char[]s){if(s.length!=5)return 0;int a=s[0],b=s[1],c=s[2],d=s[3],e=s[4],z=b-a,y=c-b,x=d-c,w=e-d;return e!=a?0:(z>0&y>0&x<0&w<0)|(z<0&y>0&x>0&w<0)|(z>0&y<0&x<0&w>0)|(z<0&y<0&x>0&w>0)?1:0;}

It returns an `int` (`0` or `1`) instead of a `boolean`, because OP didn't explicit asked for [a truthy/falsey](http://meta.codegolf.stackexchange.com/a/2194/52210) return-type, but "*The output can be true/false, 1/0, 1/Null, etc.*" instead.

**Explanation:**

- If the length of the string isn't 5, we return `0` (false)
- If the first character doesn't equal the last character, we return `0` (false)
- Then we check the four valid cases one by one (let's indicate the five characters as 1 through 5), and return `1` (true) if it complies to any of them (and `0` (false) otherwise):
 1. If the five characters are distributed like: `1<2<3>4>5` (i.e. `ALPHA`)
 2. If the five characters are distributed like: `1>2<3<4>5` (i.e. `EAGLE`, `HARSH`, `NINON`, `PINUP`)
 3. If the five characters are distributed like: `1<2>3>4<5` (i.e. `RULER`)
 4. If the five characters are distributed like: `1>2>3<4<5` (i.e. `THEFT`, `WIDOW`)

These four rules can be simplified to `1*3<0 and 2*4<0` (thanks to [*@KarlNapf*'s Python 2 answer](https://codegolf.stackexchange.com/a/96569/52210)).

**Ungolfed & test code:**

[Try it here.](https://ideone.com/9zTQes)

 class M{
 static int c(char[]s){
 return s.length == 5
 && (s[1]-s[0])*(s[3]-s[2]) < 0 & (s[2]-s[1])*(s[4]-s[3]) < 0
 & s[4]==s[0]
 ? 1
 : 0;
 }
 
 public static void main(String[] a){
 System.out.print(c("ALPHA".toCharArray()) + ",");
 System.out.print(c("EAGLE".toCharArray()) + ",");
 System.out.print(c("HARSH".toCharArray()) + ",");
 System.out.print(c("NINON".toCharArray()) + ",");
 System.out.print(c("PINUP".toCharArray()) + ",");
 System.out.print(c("RULER".toCharArray()) + ",");
 System.out.print(c("THEFT".toCharArray()) + ",");
 System.out.println(c("WIDOW".toCharArray()));
 
 System.out.print(c("CUBIC".toCharArray()) + ",");
 System.out.print(c("ERASE".toCharArray()) + ",");
 System.out.print(c("FLUFF".toCharArray()) + ",");
 System.out.print(c("LABEL".toCharArray()) + ",");
 System.out.print(c("MODEM".toCharArray()) + ",");
 System.out.print(c("RADAR".toCharArray()) + ",");
 System.out.print(c("RIVER".toCharArray()) + ",");
 System.out.print(c("SWISS".toCharArray()) + ",");
 System.out.print(c("TRUST".toCharArray()) + ",");
 System.out.print(c("KNEES".toCharArray()) + ",");
 System.out.print(c("QUEEN".toCharArray()) + ",");
 System.out.print(c("GROOVE".toCharArray()) + ",");
 System.out.print(c("ONLY".toCharArray()) + ",");
 System.out.print(c("CHARACTER".toCharArray()) + ",");
 System.out.print(c("OFF".toCharArray()) + ",");
 System.out.print(c("IT".toCharArray()) + ",");
 System.out.print(c("ORTHO".toCharArray()) + ",");
 System.out.print(c("RULES".toCharArray()) + ",");
 System.out.print(c("".toCharArray()));
 }
 }

**Output:**

 1,1,1,1,1,1,1,1
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

AltStyle によって変換されたページ (->オリジナル) /