[Question]
  [
Read two strings from `stdin`.  
Output `Yes` if one string is a rotated version of the other.  
Otherwise output `No`
**Testcases**
Input
```
CodeGolf GolfCode
```
Output
```
Yes
```
Input
```
stackexchange changestackex
```
Output
```
Yes
```
Input
```
stackexchange changestack
```
Output
```
No
```
Input
```
Hello World
```
Output
```
No
```
  
[Answer]
## Ruby 49 41
```
a,b=$*;puts (a*2).sub(b,'')==a ?:yes: :no
```
Edit: replaced gets.split by $\*
[Answer]
## APL (28)
Takes input on two lines.
```
'No' 'Yes'[1+(⊂⍞)∊⌽∘A¨⍳⍴A←⍞]
```
Explanation:
* `A←⍞`: read a line of input and store it in A
* `⌽∘A¨⍳⍴A`: Rotate A by x, for each x in [1..length A]. Gives a list, i.e. `estT stTe tTes Test`
* `(⊂⍞)∊`: read another line of input, and see if it is in this list.
* `1+`: add one to this, giving 1 if the strings were not rotated and 2 if they were
* `'No' 'Yes'[`...`]`: Select either the first or second element from the list `'No' 'Yes'` depending on whether the strings were rotated or not.
* This value is output automatically.
[Answer]
## Python, 70 bytes
```
a,b=raw_input().split()
print ['No','Yes'][a in b*2and len(a)==len(b)]
```
[Testing ...](http://ideone.com/sMtVR)
[Answer]
**Python 70 Characters**
```
a,b=raw_input().split()
print'YNeos'[len(a)<>len(b)or a not in 2*b::2]
```
Thanks to gnibbler for the slice trick.
[Answer]
## J, 47
```
y=:>2{ARGV
(>1{ARGV e.1|.^:(i.#y)y){'No',:'Yes'
```
[Answer]
According to the spec (same string lengths): 
### Perl, 42 43 chars
```
$.=pop;$_=(pop)x2;print+(qw'yes no')[!/$./]
```
If different sized strings are allowed, the solution would be:
### Perl, 47 chars
```
$.=(pop)x8;$_=(pop)x9;print+(qw'yes no')[!/$./]
```
rbo
[Answer]
## Golfscript, 31
```
' '/:)~,\,=)~.+\/,(&'Yes''No'if
```
This one check length first, so it should work as expected.
[Answer]
## J, 57
```
{&('No';'Yes')@-:/@:((/:~@(|."0 _~i.&$))&.>)&.(;:&stdin)_
```
Sample use:
```
$ echo -n CodeGolf GolfCode | jconsole rotate.ijs
Yes
$ echo -n stackexchange changestackex | jconsole rotate.ijs
Yes
$ echo -n stackexchange changestack | jconsole rotate.ijs
No
$ echo -n Hello World | jconsole rotate.ijs
No
```
[Answer]
## Windows PowerShell, 76
```
$a,$b=-split$input
('No','Yes')[+!($a.length-$b.length)*"$b$b".contains($a)]
```
[Answer]
## JavaScript, 51
```
function f(a,b)a&&(a+a).replace(b,"")==a?"Yes":"No"
```
JavaScript doesn't have a canonical host, so this answer is written as a function of two arguments. The score goes up to 60 if we disallow JS 1.7 features (expression closures).
In the SpiderMonkey shell this would be (for a score of 71):
```
[a,b]=readline().split(" ");print(a&&(a+a).replace(b,"")==a?"Yes":"No")
```
[Answer]
## Python, 66 63
```
a,b=raw_input().split()
print'YNeos'[a!=(2*a).replace(b,"")::2]
```
**Another solution in 69 char**
```
a,b=raw_input().split()
print['No','Yes'][a in b*2and len(a)==len(b)]
```
[Answer]
## J, 84
```
y=:(>1{ARGV),:(>2{ARGV)
((0{y)e.(y&((]$0{[),(]-~[:}.[:$[)$1{[)/.i.}.$y)){'No',:'Yes'
```
[Answer]
**JavaScript (120 chars)**
```
function f(a,b) {for (i=0,A=a.split("");A.join("")!=b&&i++<a.length;A.push(A.shift()));return A.join("")==b?'Yes':'No';}
```
Output:
```
f('CodeGolf','GolfCode'); //Yes
f('stackexchange','changestackex'); //Yes
f('stackexchange','changestack'); //No
f('Hello','World'); //No
f('nn','nBn'); //No
```
[Answer]
## Ruby, 58 (62) characters
```
a,b=gets.split;$><<(a.size==b.size&&/#{a}/=~b*2?:Yes: :No)
```
This solution assumes the input contains only alphanumeric characters (actually everything that doesn't have a special meaning inside a regular expression is ok).
A solution that doesn't have this constraint is 4 characters longer
```
a,b=gets.split;$><<(a.size==b.size&&(b*2).index(a)?:Yes: :No)
```
[Answer]
## Python, 71
```
a,b=raw_input().split()
print'Yes'if a in b*2and len(a)==len(b)else'No'
```
[Answer]
## PHP, 61
```
<?echo preg_match('/^(.+)(.*) \\2\\1$/',fgets(STDIN))?Yes:No;
```
[Answer]
## Ruby, 41
```
puts gets =~ /^(.+)(.*) \2\1$/ ?:Yes: :No
```
[Answer]
## Haskell (98 96 chars)
```
g x y@(t:r)(z:w)|x==y="Yes"|1>0=g x(r++[t])w
g _ _[]="No"
f(x:y:_)=g x y y
main=interact$f.words
```
[Answer]
# Q (~~50~~ 43 chars)
```
{`No`Yes x in((!)(#)y)rotate\:y}." "vs(0:)0
```
[Answer]
**Scala 78**
```
val b=readLine split " "
print(b(0).size==b(1).size&&(b(0)+b(0)contains b(1)))
```
It's a shame about the size check, without it the count drops to **54**
```
val a=readLine split " "
print(a(0)+a(0)contains a(1))
```
[Answer]
## bash 56
```
read a b
[[ $a$a =~ $b&&$b$b =~ $a ]]&&echo Yes||echo No
```
[Answer]
# GolfScript, 25 bytes
```
' '/~.2*@/''+='Yes''No'if
```
### How it works
```
             # STACK: "CodeGolf GolfCode"
' '/         # Split input string by spaces.
             # STACK: [ "CodeGolf" "GolfCode" ]
~            # Dump the array.
             # STACK: "CodeGolf" "GolfCode"
.            # Duplicate the topmost string.
             # STACK: "CodeGolf" "GolfCode" "GolfCode"
2*           # Repeat the topmost string.
             # STACK: "CodeGolf" "GolfCode" "GolfCodeGolfCode"
@            # Rotate the three topmost strings.
             # STACK: "GolfCode" "GolfCodeGolfCode" "CodeGolf"
/            # Split the second topmost string around the topmost one.
             # STACK: "GolfCode" [ "Golf" "Code" ]
''+          # Flatten the array of strings.
             # STACK: "GolfCode" "GolfCode"
=            # Check for equality.
             # STACK: 1
'Yes''No'if  # Push 'Yes' for 1, 'No' for 0.
             # STACK: "Yes"
```
[Answer]
# CJam, 21 bytes
```
r]r_,,\f{\{(+}*}_@+^!
```
[Try it online!](http://cjam.aditsu.net/#code=r_%2C%2C%5Cf%7B%5C%7B(%2B%7D*%7D_%5Br%5D%2B%5E!&input=golfcode%20codsgolf) 
[Answer]
# [Husk](https://github.com/barbuz/Husk), 14 bytes
Not sure about the rules here, Husk doesn't do IO at all. The closest alternative is a function:
```
!w¨Ye∫No¨€U¡ṙ1
```
[Try it online!](https://tio.run/##yygtzv7/X7H80IrI1Ecdq/3yD6141LQm9NDChztnGv7//985PyXVPT8n7T@IAHEA "Husk – Try It Online")
### Explanation
```
!w¨Ye∫No¨€U¡ṙ1
           ¡    -- iterate the following for ever:
            ṙ1  --   rotate string by 1
          U     -- only keep the longest prefix with unique elements
         €      -- is the argument in that list?
  ¨Ye∫No¨       -- compressed string: "Yes No"
 w              -- split on space
!               -- modular index (1-based)
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~17~~ 13 bytes
```
ɠṙJɠeị“Yes“No
```
[Try it online!](https://tio.run/##y0rNyan8///kgoc7Z3qdXJD6cHf3o4Y5kanFQNIv//9/5/yUVPf8nDQuEAHiAAA "Jelly – Try It Online")
## How it works
```
ɠṙJɠeị“Yes“No - Main link. Takes no arguments
ɠ             - Read a line from STDIN
  J           - Indices; [1, 2, ..., len(S)]
 ṙ            - All rotations of S
   ɠe         - Read a line from STDIN; is that in the rotations?
     ị“Yes“No - Index that into ["Yes", "No"]
```
[Answer]
**Lua 115 chars**
```
a,b=io.read():match"(%w+) (%w+)"c=b repeat c=c:sub(2,-1)..c:sub(1,1) s=s or a==c until b==c print(s and"Yes"or"No")
```
[Answer]
## C program - 146
```
char b[99],c[99],*p,*q;main(n){q=(p=b+(n=strlen(gets(c))))+n;sprintf(b,"%s%s"
,c,c);for(gets(c);p>b&&strcmp(p,c);--p,*--q=0);puts(p>b?"Yes":"No");}
```
[Answer]
## PHP, 82 characters
```
<?$s=split(" ",fgets(STDIN));echo str_replace($s[1],"",$s[0].$s[0])==$s[0]?Yes:No;
```
[Answer]
**perl, 123 chars**
```
@s1=split(//,shift);
$s2=shift;
$i=0;
while($i<=@s1){
    if(join("",@s1) eq $s2){die "yes";}
    unshift @s1,pop @s1;
    $i++;
}
die "no";
```
[Answer]
## Ruby, 30 37
```
gets
puts~/^(.+)(.*) \2\1$/?:Yes: :No
```
A version that prints "true" and "false" instead of "yes" and "no":
```
gets
p !! ~/^(.+)(.*) \2\1$/
```
Both of these work with different-length strings (unlike the old one)
]