Company: Barclays
Difficulty: medium
Magic Mirror and Rotated Words Charlie has a magic mirror. The mirror shows right rotated versions of a given word. To generate different right-rotations of a word, write the word in a circle in clockwise order, then start reading from any given character in clockwise order till you have covered all the characters. For example: In the word \"sample\" , if we start with \'p\' , we get the right rotated word as \"plesam\" . There are six such right rotations of \"sample\" including itself. The inputs to the function isSameReflection consist of two strings, word1 and word2 . The function returns 1 if word1 and word2 are right rotations of the same word, and -1 if they are not. Both word1 and word2 will strictly contain characters between a-z . Input Format The first line contains a string word1 . The second line contains a string word2 . Output Format Return 1 if the two words are right rotations of the same word, and -1 otherwise. Constraints 1 ≤ |word1|, |word2| ≤ 10 5 word1 and word2 c