Can someone tell me what's wrong with my solution on problem C div3 contest 527? I tried to form the string and did it right in all the examples I could think of, and then trying to check if the query it's a suffix or preffix or if it can be both. Submission: https://codeforces.com/contest/1092/submission/47232626
do a dry run on this case : 4 a c ac ab aba bac
expected o/p : PSSPPS , your o/p : PSPPPS