[Question]
  [
# The Task
In this challenge, your task is to write a program or function which takes in a String and outputs a truthy or falsey value based on whether the first character and the last character of the input String are equal.
## Input
You may take input in any way reasonable way. However, assuming that the input is present in a predefined variable is not allowed. Reading from a file, console, command line, input field etc., or taking input as a function argument is allowed.
## Output
You may output in any reasonable format, except for assigning the result to a variable. Writing to a file, console, command line, modal box, function `return` statements etc. is allowed.
## Additional Rules
* The input can be empty String as well, for which you should return a falsey value.
* Single-Char Input Strings should have a truthy result.
* Your program should be case-sensitive. `helloH` should output a falsey value.
* You can only have a single Truthy value and a single Falsey value. For example, outputting `false` for an Input String and `0` for another input String as Falsey values is not allowed.
* [Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are not allowed.
## Test Cases
```
Input    ->    Output
"10h01"        Truthy
"Nothing"      Falsey
"Acccca"       Falsey
"eraser"       Falsey
"erase"        Truthy
"wow!"         Falsey
"wow"          Truthy
"H"            Truthy
""             Falsey
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins!
  
[Answer]
# [Python 3](https://docs.python.org/3/), 23 bytes
```
s=input()
s[0]!=s[-1]<e
```
Output is via exit code, so **0** (success) is truthy and **1** (failure) is falsy. If [this](https://codegolf.meta.stackexchange.com/a/11908/12012) is acceptable, a byte can be saved.
[Try it online!](https://tio.run/nexus/bash#XY29CoNAEIRr7ynWQ7mkUBSrJGdCulR5AbUQf@I1e@KuiE9vFtJlYGY@mGK6luEOxO3C5YB9Ou9gLaQHlQ7nlU9nRVXWhCVVSd7Y4kiVGv0CBA7B5NmU5QbM2/Pk8CP07EStwOa38FeSL7G5Qe9VMO88eSz@Hy3oiLTMi0MewcTJha4QrzUa0LVstdYQPVQQqN7jcHwB "Bash – TIO Nexus")
### How it works
First of all, if **s** is an empty string, `s[0]` will raise an *IndexError*, causing the program to fail.
For non-empty **s**, if the first and last characters are equal, `s[0]!=s[-1]` will evaluate to *False*, so the program exits cleanly and immediately.
Finally, if the characters are different, `s[0]!=s[-1]` will evaluate to *True*, causing the compairson `s[-1]<e` to be performed. Since **e** is undefined, that raises a *NameError*.
If backwards compatibility with Python 2 is not desired,
```
s[0]!=s[-1]<3
```
works as well, since comparing a string with an integer raises a *TypeError*.
[Answer]
# JavaScript, 19 bytes
```
a=>a.endsWith(a[0])
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 4 bytes
```
h~t?
```
[Try it online!](https://tio.run/nexus/brachylog2#@59RV2L//79SSWpxiRIA "Brachylog – TIO Nexus")
### Explanation
```
h       The head of the Input...
 ~t?    ...is the tail of the Input
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
S¬Q¤
```
[Try it online!](https://tio.run/nexus/05ab1e#@x98aE3goSX//xsaZBgYAgA "05AB1E – TIO Nexus") or [Try All Tests](https://tio.run/nexus/05ab1e#K6v8H3xoTeChJf8rlQ7vt1JQstf5H61kaJBhYKiko@SXX5KRmZcOZDkmA0EikFGeX64IoYCkBxArxQIA "05AB1E – TIO Nexus")
```
S    # Split the input into individual characters
 ¬   # Get the first character
  Q  # Check all characters for equality to the first
   ¤ # Get the last value i.e. head == tail
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
=ṚḢ
```
[Try it online!](https://tio.run/nexus/jelly#@2/7cOeshzsW/f//X0kJAA "Jelly – TIO Nexus")
[Answer]
# Mathematica, 15 bytes
```
#&@@#===Last@#&
```
Takes an array of chars. Throws errors when the input is empty but can be ignored.
[Answer]
# [Haskell](https://www.haskell.org/), 21 bytes
`c` takes a `String` and returns a `Bool`.
```
c s=take 1s==[last s]
```
[Try it online!](https://tio.run/nexus/haskell#y03MzLPNzCtJLUpMLlEpzcvJzEst1stNLNCIKda1K87IL1co1tZWUtC1U1DS1gbxNZIVijU19cAK/wPZtiWJ2akKhsW2ttE5icUlCsWx//8bGmQYGHL55ZdkZOalczkmA0EiV3l@uSKI4PLg4gIA "Haskell – TIO Nexus")
* If not for empty strings, this could have been 16 bytes with `c s=s!!0==last s`.
* `take 1s` gives a list that is just the first element of `s` unless `s` is empty, in which case it's empty too.
* `last s` would error out on an empty string, but Haskell's laziness saves it: A string with a single element is always different from the empty string, without evaluating its element.
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~13~~ 12 bytes
```
^(.)(.*\1)?$
```
[Try it online!](https://tio.run/nexus/retina#U9VwT/gfp6GnqaGnFWOoaa/y/7@hQYaBIZdffklGZl46l2MyECRyleeXK4IILg8uAA "Retina – TIO Nexus") Includes test suite. Edit: Saved 1 byte thanks to @Kobi.
[Answer]
# [C++ (gcc)](https://gcc.gnu.org/), 40 bytes
```
[](auto s){return s[0]&&s[0]==s.back();}
```
[Try it online!](https://tio.run/##RYyxDoMwEEP3@4oTlVAytOoewo8ghvQIKGoJiLtMiG9PUxjqwbKeZdO63ieifAuRPmnw2LBsIU4t/ElYCvNubgESlw6jmz2vjjyyDAYgRMHZhag07IBF1wcKWqwqcyKXZMERbe56dWbW@@YlbRG5e/Z1/XNr@fFy9FbaHPna0ZIEmwZHJdrAkb8 "C++ (gcc) – Try It Online")
[Answer]
# Java, ~~81~~ 77 bytes
* -4 bytes, thanks @KevinCruijssen
[**Try Online**](http://ideone.com/cNSyOT)
```
boolean f(String s){int l=s.length();return l>0&&s.charAt(l-1)==s.charAt(0);}
```
* Returns `true` if they're equal, otherwise `false`, `false` for empty string
**Array Version, 60 bytes**
```
boolean f(char[]s){int l=s.length;return l>0&&s[0]==s[l-1];}
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~26~~ ~~25~~ 24 bytes
Thanks to *@Dennis* for saving a byte!
```
lambda x:""<x[:1]==x[-1]
```
[Try it online!](https://tio.run/nexus/python2#S1OwVYj5n5OYm5SSqFBhpaRkUxFtZRhra1sRrWsY@7@gKDOvRCFNQ8nQIMPAUEmTCy7gl1@SkZmXjizkmAwEicgi5fnlimh8ZK4HMkdJ8z8A "Python 2 – TIO Nexus")
[Answer]
# [brainfuck](https://github.com/TryItOnline/tio-transpilers), 43 bytes
```
+>,[<,[>[->+<<->],]]<[[-]-<]-[----->+<]>--.
```
[Try it online!](https://tio.run/nexus/brainfuck#FcmxDQAgEALAgXyM9oRFCL37L/DqtddDZZZlaJBQKqGNgIHxvYiA2b3XWfsC "brainfuck – TIO Nexus")
### Explanation
The main loop is `[>[->+<<->],]`. After each iteration, the cell to the right of the current position is the first byte of the string, and the cell to the left is the difference between the most recently handled character and the first. `<[[-]-<]` converts the final result to -1 if nonzero, and the rest converts -1 and 0 to 48 and 49 ("0" and "1") respectively.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 4 bytes
```
⊃⌽=⊃
```
[Try it online!](https://tio.run/nexus/apl-dyalog#@@/4qG3Co67mRz17bYHU//@OCuqGBhkGhupcQFZ5fjmY9gCTfvklGZl56WC2YzIQJMIUKYIZ6gA "APL (Dyalog Unicode) – TIO Nexus")
### Explanation
```
  =                     Compare
   ⊃                    The first element of the right argument with
 ⌽                      The right argument reversed
                        This will return an array of the length of the reversed argument. Each element in the resulting array will be either 0 or 1 depending on whether the element at that position of the reversed argument equals the first element of the original right argument
                        So with argument 'abcda', we compare 'a' with each character in 'adcba' which results in the array 1 0 0 0 1
⊃                       From this result, pick the first element.
```
Here is the reason this works on empty strings. Applying `⊃` to an empty string returns a space . But reversing an empty string still returns an empty string, so comparing an empty string with a non-empty string (in this case ) gives an empty numerical vector. And applying `⊃` to an empty numerical vector returns `0`. Hence passing an empty string returns `0`.
[Answer]
# MATL, 5 bytes
```
&=PO)
```
Try it at [MATL Online!](https://matl.io/?code=%26%3DPO%29&inputs=%27abcd%27&version=19.10.0)
**Explanation**
```
       % Implicitly grab input as a string (of length N)
&=     % Perform an element-wise equality check yielding an N x N matrix
P      % Flip this matrix up-down
O)     % Get the last value in the matrix (column-major ordering)
       % Implicitly display the result
```
In the case, that an empty input string must be handled, then something like the following (8 bytes) would work
```
&=POwhO)
```
This solution simply prepends a `0` to the front of the N x N matrix such that for an empty input, when the matrix is `0 x 0`, there's still a `0` value that is then grabbed by `0)`
Try it at [MATL Online](https://matl.io/?code=%26%3DPOwhO%29&inputs=%27abcd%27&version=19.11.0)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 bytes
```
tJ ¥Ug
```
[Try it online!](https://tio.run/nexus/japt#@1/ipXBoaWj6//9KjkmOSgA "Japt – TIO Nexus")
[Answer]
# Java, ~~52~~ 43 bytes
```
s->!s.isEmpty()&&s.endsWith(""+s.charAt(0))
```
To make it work, feed this into a function such as the following that makes a lambda "go":
```
private static boolean f(Function<String, Boolean> func, String value) {
  return func.apply(value);
}
```
[Answer]
# Ruby, ~~26~~ 24 bytes
*Saved two bytes thanks to [@philomory](https://codegolf.stackexchange.com/users/47276/philomory)!*
```
->e{!!e[0]>0&&e[0]==e[-1]}
```
First post on codegolf -))
[Answer]
# [GNU grep](https://www.gnu.org/software/grep/), 12 bytes
```
^(.)(.*\1)?$
```
Run in extended or PCRE mode.
I don't know if this is considered cheating or not.
[Answer]
## JavaScript, 20 bytes
Add `f=` at the beginning and invoke like `f(arg)`.
```
_=>_[0]==_.slice(-1)
```
```
f=_=>_[0]==_.slice(-1)
i.oninput = e => o.innerHTML = f(i.value);
```
```
<input id=i><pre id=o></pre>
```
### Explanation
This function takes in an argument `_`. In the function body, `_[0]==_.slice(-1)` checks whether the first element of `_` (at `0`th index) equals the last element of it, and returns the appropriate `true` or `false` boolean.
[Answer]
# PHP>=7.1, 23 Bytes
prints 1 for equal and nothing if the character is different
```
<?=$argn[0]==$argn[-1];
```
[Answer]
## C#, ~~38~~ 30 bytes
```
s=>s!=""&&s[0]==s[s.Length-1];
```
*Saved 8 bytes thanks to @raznagul.*
[Answer]
## R, 40 bytes
```
function(x)x>""&&rev(y<-charToRaw(x))==y
```
Thanks to Nitrodon for -2 bytes.
Thanks to MickyT for -8 bytes.
Test:
```
f=function(x)x>""&&rev(y<-charToRaw(x))==y
test <- c("10h01", "Nothing", "Acccca", "wow!", "wow", "H", "")
sapply(test, f)
all(sapply(test, f) == c(T, F, F, F, T, T, F))
```
Output:
```
> f=function(x)x>""&&rev(y<-charToRaw(x))==y
> test <- c("10h01", "Nothing", "Acccca", "wow!", "wow", "H", "")
> sapply(test, f)
  10h01 Nothing  Acccca    wow!     wow       H         
   TRUE   FALSE   FALSE   FALSE    TRUE    TRUE   FALSE 
> all(sapply(test, f) == c(T, F, F, F, T, T, F))
[1] TRUE
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~39~~ 33 bytes
```
 2i&01. >~&-?v1v
  i:1+?!^01. >0>n;
```
This is my first time both using ><> and playing code golf, so helpful suggestions would be appreciated.
The code is in three basic sections.
```
2i&01. Pushes an arbitrary number (2 in this case, this causes an empty string to print 0) onto the stack and puts the input's first character in the register.
>i:1+?!^01. Main loop. Pushes the next character onto the stack. If the string has been read completely, then go to the last section
>~&-?v1v
     >0>n;  Compare the first and last characters. Print 1 if they're the same, 0 if not
```
[Answer]
# [shortC](//github.com/aaronryank/shortC), ~~27~~ ~~26~~ ~~25~~ 24 bytes
```
f(C*s){T*s&&*s==s[Ss)-1]
```
How it works:
```
f(C*s){                     declare int-returning function that takes a string
       T                    return
        *s                  provided string has any length
          &&                and
            *s==s[Ss)-1]    the first character equals the last one
```
[Try it online!](https://tio.run/##LcmxCoMwEAbgVzkClVywQ2dx6iM0W@kQ6kkONC35Dxykzx47OH3Dh/yp9m5r0uJ5/1YtNnt3mVz/J2YFwVI10KaWybIQ0iq0iJlUSiA1kjKdHx3z8GuzvwfwHgO6LmAc8XyAr7dXawc)
[Answer]
# Google Sheets, 33 Bytes
Takes input from cell `[A1]` and outputs `1` for truthy input and `0` for falsey input.
```
=(A1<>"")*Exact(Left(A1),Right(A1
```
It is noted that the parentheticals in `Exact(` and `Right(` are left unclosed as Google Sheets automatically corrects this as soon as the user has input the formula text and pressed enter to leave that cell.
### Output
[![GS Version](https://i.stack.imgur.com/hyFkX.png)](https://i.stack.imgur.com/hyFkX.png)
[Answer]
# R, ~~50~~ ~~43~~ ~~41~~ ~~40~~ 64
Second solution with 41 bytes for a callable function - thanks to @niczky12 & @Giuseppe - amended for x=""
```
r=function(x,y=utf8ToInt(x))ifelse(x=="","FALSE",(y==rev(y))[1])
```
First with 50 bytes but not for the challenge 
```
function(x){charToRaw(x)[1]==rev(charToRaw(x))[1]}
```
[Answer]
# [Mornington Crescent](https://github.com/padarom/esoterpret), 2585 bytes
```
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Victoria
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Hammersmith
Take District Line to Bow Road
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Barking
Take District Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Bank
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Temple
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Aldgate
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
Take Northern Line to Bank
Take Circle Line to Temple
Take District Line to Bow Road
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Bow Road
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Aldgate
Take Circle Line to Victoria
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
Take Northern Line to Bank
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
```
[Try it online!](https://tio.run/##3VZNb8IwDL3vV@S0Ezts@wXAJjhQhKZu96h4NCKxkWOp4tez7ANQ26XQMpi283P8nOdnJ44YDS6E8CZj8BmgbDapXoKaEksOjGpiEJSQGmhcXn1AQ8OZhR0w1s4Be2ck/8QfjBc2mewiEhPCH3EegfeZa6TDXHOoTw2ZvD8h5oTin1fOoBfgCF7LUGF4CcHERkeOzzR7Qq9GDIAHBepQPcL62MrrxFSoJ9KxxvXDzVClVHwVPjNZpufG2vWeA7TkHNKkwEFHbb267am7nrqPHqlmPUh7aU0HmpfBcJ1VPXocKpX95pxEgSmJvGcdhx6qkRZoE9V62A7hKbiVhU59O9OQtTRLhbtv54uYpiUsAWFakTWiSx23r4SirtVEi3Fb2b4NbqI6fUu2N9YFr54QcZSrDNYmpo8LsG2nqdmmzUu32Wzdl1oz6x8xavmx/c@O@hlfNDwpye5rGF6M7dewoOIN "Mornington Crescent – Try It Online")
I thougt, this was easier...
Outputs 0 for false and 1 for true
```
// Prepare input for right substring
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
// Get char code of first character
Take District Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
// Put it in Upminster for later calculation
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
// Also save it for later check for null string # Victoria = char code of first
Take District Line to Hammersmith
Take Circle Line to Victoria
// Save 0 # Upney = 0, Bow Road = 0 (for second loop)
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Hammersmith
Take District Line to Bow Road
// Save 1 # Barking = 1
Take District Line to Acton Town
Take Piccadilly Line to Heathrow Terminals 1, 2, 3
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Barking
// Get char code of last letter of input
Take District Line to Hammersmith
Take District Line to Mile End
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
// Bitwise NOT, so we get -(char count)-1
Take Northern Line to Bank
Take Circle Line to Bank
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
// Add it to the char code of first letter. If they match, the result is -1.
Take District Line to Upminster
// Save the result in Upminster
Take District Line to Upminster
// ********************************************************************************
// * Add some logic. This is quite puzzling because the only control structure    *
// * in Mornington Crescent is a post-test loop. You don't have something like    *
// * an if-else. You can't skip code. You can only define how often a loop should *
// * be repeated.                                                                 *
// * My solution to this is: When checking if the first and last character        *
// * are the same (first char code - last char code = 0), I swap the positions    *
// * of the 0 and 1 variables, then multiply the result of the equality check     *
// * with the new position of 1. If the characters are the same, the loop will    *
// * exit after the first run. If not, it will run another time, swapping the     *
// * 0 and 1 back and exiting after the second run, because it multiplies the     *
// * new equality check with 0.                                                   *
// ********************************************************************************
// Set starting line of loop
Take District Line to Temple
// Swap 0 and 1 # Upney = 1, Barking = 0 (on the first run)
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upney
Take District Line to Barking
// Save 1 in Chalfont & Latimer for later multiplication
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
// Add 1 to Upminster, to check for equality
Take Metropolitan Line to Aldgate
Take Circle Line to Hammersmith
Take District Line to Upminster
// Multiply the result with 1 in the first run, or 0 in the second run
Take District Line to Bank
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
// If the result is not 0, run the loop again
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
// **********************************************************************
// * Another control loop to check for empty string.                    *
// * The previous loop will return true if an empty string was entered. *
// **********************************************************************
// Set start of loop
Take Northern Line to Bank
Take Circle Line to Temple
// Swap 0 and 1 # Upney = 0, Bow Road = 1 (on the first run, if previous loop ran once)
//              # Upney = 0, Bow Road = 0 (if previous loop ran twice)
Take District Line to Bow Road
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Bow Road
// store 1 in Chalfont & Latimer for later multiplication
Take District Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
// Multiply by char code of first char (0 if empty string)
Take Metropolitan Line to Aldgate
Take Circle Line to Victoria
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
// Loop again if input not empty
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Northern Line to Angel
// Fetch result and go home for output
Take Northern Line to Bank
Take District Line to Upney
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
```
[Answer]
# [BRASCA](https://github.com/SjoerdPennings/BRASCA), 3 bytes
This looks like a job for `M`!
```
M=n
```
[Try it online!](https://tio.run/##zVt7c9s2Ev9fnwK1r7VUS7LsJE3is9yLkzR1W8cZ253rjcdVIBGymJIEQ4KR1ddXz@2CDxEkKIL1UzOJJRLY/e0Tr4W/EDPuPXrmB59t1@eBIOEi7BKXilmX2IIFgnMnbE0D7hJhu4ykrRzG/PhxQD0L/iQv8Bf8u2St5IEI6ISN6eS3Vmvi0DAkBwENJ/Qlft9tEfisra2dCmjQJQG7tENgGhKgQj7RwKZjh4XQQDa02JSMRrZni9GoHTJn2tltyRf4WZc0ZMeMTPYSG/dD2WBIzi/U5xSeDdRHY@XRkseLgJE5A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mRUCRtsCmynsHq3agrkmxXcqfeXMjTHyFoWkciDBc2eXnUyL1XhJeAKpSrrR/IMLb2tW7yla5QC2dWE@YL8yBZjDokHi62CIPJF4dJbOZsnHV/LP5C20ZAFcdZPucviW85z5gkyD7h32cWjAD4H4xDgxFW48VR67fXJyfHJLtF1Lxy@xx2ye/x9SNcuFSMAVzyFyYkQXwQ5TBw3ubfSarpwWLZVQgB8TLPCWHnQf439UDpcOQvRYMTQ12MsL1Zp3Zqtgrg@QJe0aZmsllyizzK5FWI3Frle3OaiVoqJn8//Bw "Python 3.8 (pre-release) – Try It Online")
## Explanation
```
M        - Move the bottom of the stack to the top
 =       - Are they the same? Push 1 if it is, 0 if it isnt.
  n      - Output as number.
```
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang), 20 bytes
```
O<!=xP?AxA Gx-Lx 1 1
```
[Try it online!](https://tio.run/##rVltU9tIEv5s/4rBKWyNXxJJcFVbtmUXyQKhlkAWktsP4AtClkF1suyTZF6WkL@e6@550cgWucvd8sGyZp7u6X6mp7vHBL2bIPj@KkqCeDUNh1k@jRavb0d1cySOrktDQf64DNdAaZTclIbyaC4w03AWJSGLYxYvkhv6qOvRTyefPzCneD3/dMbc4vXve2dst3g9OHnHfilezz4zpwAfHJ8b2JPPxwb088mHvfPfrIwzCz@a7JvzN65n985hWTEZ3Popa/NCwESBrVrFaMR2i7mT/T9wMoFJ8ugrw@/D4RoGlyEMugmYOOYILGHenp4eEwg/xuRkH30zDDk7FACQN2y98@NVyPlFMuH1OvkBu3Ix8c4a@6cH1vfT4Zb38HG897DHDh96xw/MYc53DlONgUC3AR76c@ah3KBeB@VLP81Ci7Onei1KchYN6jUYpYW6rD1bJQGMkHAA7/l82c2WyYU78Z7srv0MOmoRqCM8PG0cePMG1UdLdn8b5WG29IOwXoPvcWjBOIhbwowua1zml8nl7DJlT88XE4v3XzU4mVKLZszS1nqs9arFmVChRrdg9DKB4U5HjICdtTDOQnPgWZgT3IbBP9lskbJkNb8O00zaw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Pmv/428zEGGGi0/aPVNdKkbXsd6RdYtT//0fUe1wMWFB3G10qVHp0LCoMaJV5I20iRKIKLT0WLC5D/APfHrmNmPlrxjFS3OUbm5R6ghP3b7OwYth@Jm4RmNWMcsQJtXqUTeT7r6LOyU@t5zQfSa0sF6yXOrSt4O132Aq6V3afA/NERoGD5xKwJ9R9DtkNkbueAhrtpxsEmiBkHEv5ikByE68iTA6tNw5kOSBM9UIxolMBlN6bcmP8ihTLW2gxa2pjjC2QuXXVSmayB0g/L3hrkfJdjTMj@9CbqktN2G73ccf9Wiayj@s8eyyZrybe/5@/v3/vt/Aw "C (gcc) – Try It Online")
Takes a line from stdin and prints `true` if equal and `false` otherwise.
```
O                           Output the result of:
  < ! (= x P)                 x = input; x is not null and
    ? A x                       the first char's ord is equal to
      A (G x (- L x 1) 1)       the (length-1)th char's ord
```
[Answer]
# Swift, 46 bytes
```
var s=readLine()!,a=Array(s);a[0]==a.last ?1:0
```
]