Help me (Anagram Substring)

Rotate a given String in specified direction by specified magnitude.

After each rotation make a note of first character of the rotated String, After all rotation are performed the accumulated first character as noted previously will form another string, say FIRSTCHARSTRING.

Check If FIRSTCHARSTRING is an Anagram of any substring of the Original string.

If yes print "YES" otherwise "NO". Input

The first line contains the original string s. The second line contains a single integer q. The ith of the next q lines contains character d[i] denoting direction and integer r[i] denoting the magnitude.

nput

carrace
3
L 2
R 2
L 3

Output

NO

Explanation
After applying all the rotations the FIRSTCHARSTRING string will be "rcr" which is not anagram of any sub string of original string "carrace".

Help me buddy in this question. I solved but i got Wrong Answer
How can we know what's wrong with your code, if you don't show it to us?
Topic archived. No new replies allowed.