[Question]
  [
Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example:
"Abc" and "Cde" are equivalent because
```
distance from a-c == 2
distance from b-d == 2
distance from c-e == 2
```
The capitalization doesn't make any difference.
"Hello" and "World" are not Caesar equivalent because
```
distance from h-w == 15
distance from e-o == 10
distance from l-r == 6
distance from l-l == 0
distance from o-d == 15
```
"Abcd" and "Yzab" are Caesar equivalent because
```
distance from a-y = 24
distance from b-z = 24
distance from c-a = 24 (it wraps around)
distance from d-b = 24
```
You must write a full program that takes two strings from STDIN, and prints a truthy value if they are Caesar equivalent, and a falsy value if they are not. 
# Valid Input
* Since capitalization doesn't matter, it is acceptable if your program requires the input to be all lower-case, all upper-case, or whatever mix you want, as long as this is specified in your answer.
* The input will not have spaces or punctuation.
* The inputs will be the same length.
  
[Answer]
# CJam, ~~17~~ ~~12~~ 11 bytes
*1 byte saved by Dennis.*
```
ll.m26f%)-!
```
[Test it here.](http://cjam.aditsu.net/#code=ll.m26f%25)-!&input=abc%0AYZA)
Expects the first string to be lower case and the second to be upper case. Prints `1` for Caesar-equivalent strings and `0` otherwise.
## Explanation
```
ll           e# Read two lines of input.
  .m         e# Take the differences of corresponding characters.
    26f%     e# Take the differences modulo 26.
        )-   e# Remove all copies of the last difference from the array. This will 
             e# yield an empty array if and only if all differences are the same.
          !  e# Logical NOT, which yields 1 for an empty array and 0 otherwise.
```
The reason we require the first string in lower case and the second in upper case is to ensure that the difference is always positive. Otherwise taking the modulo might return something negative and would not necessarily be unique, even for Caesar-equivalent strings.
[Answer]
# Pyth, 9 bytes
```
}wm=.rzGG
```
The two strings are expected in lowercase, newline separated.
[Demonstration.](https://pyth.herokuapp.com/?code=%7Dwm%3D.rzGG&input=abcd%0Ayzab&debug=0)
How it works:
`.r` is Pyth's rotary translation function. It maps each element in the first argument from its first occurance in the second argument to the next entry in the second argument. In this, case, the second argument is `G`, the lowercase alphabet, so this is equivalent to a Caesar shift of 1.
Putting an `=` in front of the function makes it in-place. Thus, `=.rzG` assigns the Caesar shift of `z` by one to `z`. Note that `z` is initialized to the first line of input in Pyth.
This expression is used inside a map. `m=.rzGG` applies this transformation to `z` 26 times, once for each element of `G`, and saves the results in a list. This gives the list of all possible Caesar shifts of `z`.
Finally, `}w` checks whether the next line of input is in that list.
[Answer]
# APL (15)
```
1=≢∪26|-⌿⎕A⍳↑⍞⍞
```
It needs the letters to be uppercase, and prints either `1` or `0`, like so:
```
      1=≢∪26|-⌿⎕A⍳↑⍞⍞
ABCD
YZAB
1
      1=≢∪26|-⌿⎕A⍳↑⍞⍞
HELLO
WORLD
0
```
Explanation:
* `↑⍞⍞`: read two lines from the keyboard, and arrange the characters in an N×2 matrix.
* `⎕A⍳`: for each character, find at which position it occurs in `⎕A` (the uppercase alphabet).
* `-⌿`: for each column, subtract the second value from the first value
* `26|`: take the mod-26 of each of those numbers.
* If the strings are Caesar-equivalent, all numbers in this list are now equal, so:
* `≢∪`: find the number of unique values in the list
* `1=`: compare that to `1`.
[Answer]
# Prolog, 56 bytes
```
b([],[],_).
b([A|C],[B|D],N):-N is mod(A-B,26),b(C,D,N).
```
Not all combinations of cases are supported.
usage
```
b(`abcd`,`yzab`,_).
```
[Try it online here](http://swish.swi-prolog.org/p/AjgqohQx.pl)
[Answer]
# J, 19 bytes
```
1=[:#@~.26|-&(3&u:)
```
Letters at the same position should have the same case.
After converting both input strings to their codepoint representation with `&(3&u:)` we compare `1` to the length `#` of the nub `~.` of the modulo 26 `26|` of the difference `-` of the two arrays. The nub will be `1` if all Caesar-distances are the same.
Usage:
```
   'abcd' (1=[:#@~.26|-&(3&u:)) 'yzab'
1
```
[Try it online here.](http://tryj.tk/)
[Answer]
# Julia, ~~91~~ ~~87~~ 83 bytes
```
a=readline()
b=readline()
show(length(Set([mod(a[i]-b[i],26)for i=1:length(a)]))<2)
```
Ungolfed + explanation:
```
# Read two strings from STDIN
a = readline()
b = readline()
# Get the absolute difference mod 26 of the character values in the strings
x = [mod(a[i] - b[i], 26) for i = 1:length(a)]
# Construct a set consisting of the elements of x. If the set has only a
# single element, the strings are Caesar equivalent. This will print a
# boolean value to STDOUT.
show(length(Set(x)) < 2)
```
This takes advantage of the fact that strings in Julia can be treated as character arrays and that arithmetic operations can be performed on character values. The input strings can have any mix of capitalization you want, so long as the capitalization at each position matches between the strings.
[Answer]
# C99, ~~92 bytes with bug~~   ~~101~~ 92 bytes
```
  r,i;main(z,a)char**a;{for(;z=a[2][++i];)r|=(a[1][i]-z+*a[2]-*a[1]+52)%26;putchar(49-!!r);}
```
Pretty straightforward; assumes words come as first and second arguments, respectively. Compiled with `-std=c99`.
[Answer]
# Javascript (*ES7 Draft*), 87 bytes
Requires inputs to be the same case.
```
(p=prompt)(![z=(a[c='charCodeAt'](i)-b[c](i)+26)%26 for(i in b=p(a=p()))].some(x=>x^z))
```
[Answer]
# CJam, 13 bytes
```
{r(fm26f%}2*=
```
It requires the first character in each word to be in upper case, others in lower case.
[Try it here](http://cjam.aditsu.net/#code=%7Br%28fm26f%25%7D2*%3D&input=Abcd%0AYzab). ([Firefox here](http://cjam.aditsu.net/#code=%7Br%28fm26f%2525%7D2*%3D&input=Abcd%0AYzab).)
Too bad the APL variants doesn't support character arithmetics...
### Explanation
```
{
    r       e# Read a word.
    (f-     e# Return each character value minus the first character.
    26f%    e# Mod 26.
}2*         e# Repeat 2 times.
=           e# Check if they are equal.
```
[Answer]
# Perl, 80
***Edit**: A failed optimization had slipped into the golfed code. Now it matches the ungolfed version. (The byte count was correct, though.)*
```
@a=unpack"W*",<>;for(<>=~/./g){$n=ord()-shift@a;$p=!$c++||$p&&$n==$o;$o=$n}say$p
```
Run with Perl version 5.10 (`perl -M5.10.0` or `perl -E …`) for `say()`. Slightly expanded version:
```
@a=unpack"W*",<>;             # read first string, split and convert to numbers
for(<>=~/./g){                # reads the second string and splits it
   $n=ord()-shift@a;          # convert next character of second string and compare
   $p= !$c++ || $p && $n==$o; # compare differences (special case for first char)
   $o=$n
}
say $p
```
The code outputs `1` (truthy in Perl) if the strings are Caesar equivalent, and the empty string (falsy in Perl) if they are not. If this is too loose an interpretation, I need to add 2 bytes for `say$p+0`, which prints `1` or `0`.
Character case must match between inputs.
[Answer]
# Matlab, ~~49~~ 48 bytes
This was a really quick one. Sadly getting a string from stdin is quite expensive.
```
x=@()input('','s');sum(diff(mod(x()-x(),26)))==0
```
Note that it is, like most if not all answers, case sensitive.
EDIT: shaved off one byte by defining an anonymous function!
[Answer]
## C, 97 bytes
```
#define D (*a[2]++-*a[1]+++26)%26
d,r;main(int c,char**a){for(d=D;*a[1];r|=d-D);puts(r?"N":"Y");}
```
[Answer]
# [R](https://www.r-project.org/), 48 bytes
```
a=scan(,'');`+`=utf8ToInt;!sd((+a[1]-+a[2])%%26)
```
[Try it online!](https://tio.run/##K/r/P9G2ODkxT0NHXV3TOkE7wba0JM0iJN8zr8RasThFQ0M7MdowVhdIGsVqqqoamWn@T0xKrqis4kpJTQOy/v8HAA "R – Try It Online")
Standard deviation (`sd`) of the differences between the character codes (mod 26) is zero only if they are all the same. Requires all-same-case input.
[Answer]
# Scala, 57 bytes
```
(readLine zip readLine map(x=>x._1-x._2%26)toSet).size==1
```
Little longer than the others, and essentially equivalent, but it is in a vary different style of language!
I also have this version(56 bytes):
```
(readLine zip readLine map(_._1-x$1._2%26)toSet).size==1
```
But I don't know if the x$1 working is coincidence or by design...
[Answer]
**Python 2, 80 bytes**
Takes 2 similarly-cased strings from stdin separated by a space :
```
s,t=raw_input().split();print len(set((ord(c)-ord(d))%26 for c,d in zip(s,t)))<2
```
Tested on following test cases :
```
tests = [
    ("abc", "abc", True),
    ("abcd", "abc", False),
    ("abc", "cde", True),
    ("Abc", "Cde", True),
    ("abc", "deg", False),
    ("Hello", "World", False),
    ("Abcd", "Yzab", True),
    ("", "", True)
]
for s, t, v in tests:
    if len(s) == len(t): # I didn't read that at first
        assert v == (len(set((ord(c) - ord(d)) % 26 for c, d in zip(s, t))) < 2)
```
[Answer]
# Python 2 - ~~241~~ ~~237~~ ~~188~~ 147 Bytes
Takes input as lowercase string enclosed in quotes, space separated. There has to be a better way..
```
s=[[ord(x)for x in y]for y in input().split()];v=[];v=[v+[(s[1][i]-s[0][i])%26]for i in xrange(0,len(s[0]))];v=sum(v,[]);print sum(v)//v[0]==len(v)
```
Ungolfed (260-odd bytes)
```
strs = [[ord(x) for x in y] for y in raw_input().split()]
vals = []
for i in xrange(0, len(strs[0])):
if strs[0][i]<strs[1][i]:
    vals += [strs[1][i]-strs[0][i]]
else:
    vals += [26-(strs[0][i]-strs[1][i])]
return sum(vals)//vals[0] == len(vals)
```
[Answer]
# R, 83 ~~84~~
Fairly much the same as the other solutions. Convert the strings into a vector of integers. Mod the difference of the vectors by 26. Do a unique over the list as check the length is 1. It expects the case to be the same in corresponding characters in each string.
```
length(unique(((S=strtoi)((R=charToRaw)((I=readline)()),16L)-S(R(I()),16L))%%26))<2
```
It waits for the two strings to be entered
```
> length(unique(((S=strtoi)((R=charToRaw)((I=readline)()),16L)-S(R(I()),16L))%%26))<2
abcdefghijklmnopqrstuvwxyz
opqrstuvwxyzabcdefghijklmn
[1] TRUE
> length(unique(((S=strtoi)((R=charToRaw)((I=readline)()),16L)-S(R(I()),16L))%%26))<2
Hello
World
[1] FALSE
> length(unique(((S=strtoi)((R=charToRaw)((I=readline)()),16L)-S(R(I()),16L))%%26))<2
Bob
Nan
[1] TRUE
>
```
[Answer]
# Matlab/Octave, ~~53~~ 52
```
x=@()input('','s');isscalar(unique(mod(x()-x(),26)))
```
Input should all be of the same case.
Sadly, Matlab is not very good with user input. As an anonymous handle, this could be only 35 bytes:
```
@(a,b)isscalar(unique(mod(a-b,26)))
```
Matlab treats the characters of a string as a vector of numbers. Doing subtraction gets us their difference, and `unique` converts that vector into a vector containing only unique values. If there is only one number, the words are caeser equivalent and isscalar returns 1, otherwise it will return 0.
[Answer]
# bash, ~~71~~ 48
Using the “standard” Unix program `caesar(6)`.
New version (with lots of help from @DigitalTrauma):
```
read a b;seq -f"caesar %g <<<$a" 26|bash|grep $b
```
* Inputs have to be on the same line, separated by spaces
* Character case must match between inputs.
* Prints `1` for true or nothing for false.
If input via command line arguments is allowed, it can be shortened to **39 bytes**:
```
 seq -f"caesar %g <<<$1" 26|bash|grep $2
```
Old version for the record:
```
 read a b;for i in `seq 26`;do [ `echo $a|caesar $i` = $b ]&&echo 1;done
```
[Answer]
# [><> (Fish)](http://esolangs.org/wiki/Fish), 50 bytes
```
i:3b*(?v88+0.;n1<
0)?vc1.>~ri-&l?!^i-&:&-2d*%
;n0<
```
Expects letters at the same position to have the same case.
Explanation
* `i:3b*(?v` reads the first word into the stack with `88+0.` providing the looping jump
* `~ri-&` removes `~` the separating space from the stack, reverses the stack `r` (first letter will be on top), reads in the first letter of the second word `i`, calculates the offset from the first word's first letter `-` and stores it in the register `&`.
* `l?!^i-&:&-2d*%0)?v` reads every next letter of the second word substracting it from the first word's corresponding letter which is at the top of the stack substracts the offset `&:&-` stored in the register and checks if the result is 0 mod 26 `2d*%`. If not prints 0 and terminates `0n;`. `c1.` provides the looping jump.
* If reached the end of the second word the program prints 1 and terminates `1n;`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
Oạ/ċ2
```
[Try it online!](https://tio.run/##y0rNyan8/9//4a6F@ke6jf4fbn/UtOa/J5fCkW4DLoVDax7u2vE/OlopA6gsX0lHQak8vygnRSlWRyFaKTEpOUVJR6myKjEJLgBSkpySqhQbCwA "Jelly – Try It Online")
Outputs a positive integer for equivalent, 0 otherwise
## How it works
```
Oạ/ċ2 - Main link. Argument A (a list of strings)  e.g. ["abc", "cde"]
O     - Ordinal. Cast to code point                     [[97, 98, 99], [99, 100, 101]]
  /   - Reduce the list by...
 ạ    -   absolute difference                           [2, 2, 2]
   ċ2 - Count the number of 2s in the list              3
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 14 bytes(SBCS)
```
1=≢∪26|-⌿⎕UCS⎕
```
Takes input as a two row matrix and returns truthy or falsey value
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94L@h7aPORY86VhmZ1eg@6tn/qG9qqHMwkATJ/lcAgwKuR20T1R2dnNUV1J1dXNW5kIU9UnNy8oES4flFOSmoUkAdLkCZyChHJ3UA "APL (Dyalog Unicode) – Try It Online")
## Explanation
```
1=≢∪26|-⌿⎕UCS⎕
         ⎕UCS⎕ ⍝ Convert all characters to Unicode codepoints
       -⌿      ⍝ Subtract pairs of matrix along leading axis(x)
    26|        ⍝ Get residue(modulus) of 26 with each difference(works with negatives)
1=≢∪           ⍝ Check if number of unique remainders is equal to 1.
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-r`, 12 bytes
```
$=($-A^g)%26
```
[Try it online!](https://tio.run/##K8gs@P9fxVZDRdcxLl1T1cjs//@k5JTUtPRErvKKyqrEpLL/ukUA "Pip – Try It Online")
### Explanation
With the `-r` flag, `g` is a list of lines from stdin rather than the usual list of command-line arguments.
```
      ^g      Split each line into a list of characters (^ vectorizes on lists)
     A        Convert each character to its ASCII code (A vectorizes on lists)
              We now have a list of two lists of numbers.
   $-         Fold on subtraction; since - also vectorizes on lists, this does pairwise
               subtraction of the character codes, returning a list of differences
  (     )%26  Take each difference mod 26 (% also vectorizes)
$=            Fold the list on equals: 1 if all items are equal, 0 otherwise
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip), ~~33~~ 18 bytes
```
$=({Aa-Ab}%26MZqq)
```
-15 bytes from Dlosc.
[Try it online!](https://tio.run/##K8gs@P9fxVaj2jFR1zGpVtXIzDeqsFDz///EpOQULiBO/f8fAA "Pip – Try It Online")
## Explanation
```
$=({AB((Ab<Aa?-26 0)+Aa-Ab)}MZab) ; a,b → command line args
                            MZab  ; Map items of a and b to function, pass as (a,b)
   {                 Aa-Ab }      ; Subtract codepoints of a and b
       (Ab<Aa?-26 0)+             ; Add -26 if b > a
    AB(                   )       ; Take the absolute value of the whole thing
$=                                ; Check if all items of the mapped list are equal
```
[Answer]
# KDB(Q), 35 bytes
```
{0=sum(1_-':)mod[;26](-)."i"$(x;y)}
```
# Explanation
```
                         "i"$(x;y)      / convert to ascii decimal
                     (-).               / get differences
             mod[;26]                   / mod 26
      (1_-':)                           / difference between the differences
 0=sum                                  / sum should be 0 if equivalent
{                                 }     / lambda
```
# Test
```
q){0=sum(1_-':)mod[;26](-)."i"$(x;y)}["abcd";"yzab"]
1b
```
[Answer]
# Java 281
```
import java.util.*;enum C{E;Scanner s=new Scanner(System.in);public static void main(String[]z){char[]u=E.n(),v=E.n();int i=0,d=(u[0]-v[0]+26)%26;boolean e=true;for(;++i<u.length;)e&=d==(u[i]-v[i]+26)%26;System.out.print(e);}char[]n(){return s.next().toUpperCase().toCharArray();}}
```
expanded:
```
import java.util.*;
enum Caesar{
    Equivalence;
    Scanner input=new Scanner(System.in);
    public static void main(String[]z){
        char[]firstString=Equivalence.nextInput(),secondString=Equivalence.nextInput();
        int index=0,difference=(firstString[0]-secondString[0]+26)%26;
        boolean isEqual=true;
        for(;++index<firstString.length;)
            isEqual&=difference==(firstString[index]-secondString[index]+26)%26;
        System.out.print(isEqual);
    }
    char[]nextInput(){
        return input.next().toUpperCase().toCharArray();
    }
}
```
I could save 14 bytes if I got rid of converting everything to uppercase, but I feel like it's more complete to leave it in.
[Answer]
# [PowerShell Core](https://github.com/PowerShell/PowerShell), ~~68~~ 66 bytes
```
$a,$b=$args;(1..$a.Length|%{($a[--$_]-$b[$_]+26)%26}|gu).count-eq1
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNydFNzi9K/a@SpmCrUP1fJVFHJclWJbEovdhaw1BPTyVRzyc1L70ko0a1WkMlMVpXVyU@VlclKRpIaRuZaaoamdXWpJdq6iXnl@aV6KYWGv6v5VIDGqbk6OSspKDk4uqmBOUnJacABSKrEpOgIh5Ay/OBQuH5RTkpSv8B "PowerShell Core – Try It Online")
```
 (1..$a.Length                                            # Builds an array of the size of one of the input 
              |%{($a[--$_]-$b[$_]+26)%26}                 # For each of the characters, gets their distance making sure we stay between 0 and 25
                                           |gu            # Remove duplicates
                                              ).count-eq1 # Returns True if we have a single record
```
[Answer]
# [Zsh](https://www.zsh.org/) `-eo extendedglob`, 43 bytes
```
>$2
repeat 25 {1=`tr a-z b-za<<<$1`;ls ^$1}
```
[Try it online!](https://tio.run/##qyrO@K9RnFqioJuar5BaUZKal5Kakp6Tn6SglJiUnKKkoJSWnlGo9N9OxYirKLUgNbFEwchUodrQNqGkSCFRt0ohSbcq0cbGRsUwwTqnWCFOxbD2v6aanb6Wfl5pTg4XSMb@PwA "Zsh – Try It Online")
Input from command-line arguments and output via exit code. I'm not doing stdin/stdout, that's idiotic.
]