Can somebody give me a hint on how to

solve the problem https://www.codechef.com/DWWU2019/problems/DWW19H ?

Thank you very much.

There are two possibilities of having SS after concatenating n times :

- SS between 2 and s.size() ( example : PLEASS or PLSSEA or SSPLEA) --> count += ?
- first character S and last character S ( example : SPLEAS )-- > count += ?

Do these two and you will get the answer

1 Like

I donâ€™t think it is that simple.

I just had a look at your solution to this problem. It says it passed all the test cases. However, when I run your code with the following as input,

1 1 SSSSSS

Your code gives output 5, but clearly the answer is 3, right?

Did I understand the question wrong?

Answer is â€ś5â€ť.

SSSSSS:- â€śSSâ€ť,â€śSSâ€ť,â€śSSâ€ť,â€śSSâ€ť,S"SS" . In total 5-places where we find â€śSSâ€ť.

1 Like

Wowâ€¦ I should have reread the question.

1 Like