Wrong Answer for Subtask 1

This https://www.codechef.com/viewsolution/20288663 is the my solution to the question https://www.codechef.com/problems/CGSURYA . I am getting wrong answer for subtask, while I am passing Subtask 2 and 3. Can anyone help me.

Hello,
You missed following test case:

1

3

LLL

2 5 1

Answer = -1

ACed Solution by me: https://www.codechef.com/submit/complete/20292334

My opinion: test cases were pretty weak because a wrong submission got more points than slow but correct submission

I changed my code accordingly, but still I am getting Wrong Answer in one subtask. Here is my updated code.
https://www.codechef.com/viewsolution/20353302.
Also I am not able to access your solution. The link shows access denied.