ā._Êßi„Noë”…Ü
Try it online or verify all test cases.
Explanation:
ā # Push a list in the range [0, length] for the (implicit) input-string,
# without popping this input-string itself
# i.e. "CodeGolf" → [1,2,3,4,5,6,7,8]
._ # Rotate the string that many times towards the left (vectorized)
# "CodeGolf" and [1,2,3,4,5,6,7,8] → ["olfCodeG","lfCodeGo","fCodeGol","CodeGolf",
# "odeGolfC","deGolfCo","eGolfCod","GolfCode"]
Ê # Check for each whether it's NOT equal to the second (implicit) input-string
# "GolfCode" → [1,1,1,0,1,1,1,1]
ß # Pop and push the minimum (to check if any are falsey)
# [1,1,1,0,1,1,1,1] → 0 (falsey)
i # If this minimum is truthy (so all rotations were unequal to the second input):
„No # Push string "No"
ë # Else:
”…Ü # Push dictionary string "Yes"
# (after which the result is output implicitly)
See this 05AB1E tip of mine (section How to use the dictionary?) to understand why ”…Ü
is "Yes"
.
Stackexchange Stackchangeex
return? \$\endgroup\$No
. The rotation is a shift, like those LED scrolling signs \$\endgroup\$