Skip to main content
Golfed 1 byte
Source Link
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

CJam, 1212 11 bytes

r__$=\W%_$=|q_$_W%+\#)g 

Try it online!Try it online!

Explanation

rq Push Takethe input  _  _$ Duplicate it and _$sort  _W% Duplicate and sort itreverse   = + Check ifConcatenate equal the sorted and the reversed \strings  \ Swap top stack elements (bringing the originalBring wordinput to the top of the stack) W%  # Reverse it  Find the index of the input in _$the other string; returns Duplicate-1 andif sortnot itfound ) =  Increment  Check if equal  g Signum (coerces to |0 or OR1) 

CJam, 12 bytes

r__$=\W%_$=| 

Try it online!

Explanation

r Take input  _  Duplicate it  _$ Duplicate and sort it   = Check if equal  \ Swap top stack elements (bringing the original word to the top of the stack) W%  Reverse it  _$ Duplicate and sort it = Check if equal  | OR 

CJam, 12 11 bytes

q_$_W%+\#)g 

Try it online!

Explanation

q Push the input _$ Duplicate and sort  _W% Duplicate and reverse + Concatenate the sorted and the reversed strings  \ Bring input to the top # Find the index of the input in the other string; returns -1 if not found )   Increment  g Signum (coerces to 0 or 1) 
Source Link
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

CJam, 12 bytes

r__$=\W%_$=| 

Try it online!

Explanation

r Take input _ Duplicate it _$ Duplicate and sort it = Check if equal \ Swap top stack elements (bringing the original word to the top of the stack) W% Reverse it _$ Duplicate and sort it = Check if equal | OR