Can anyone give a hint? [DWW19H]

Can somebody give me a hint on how to
solve the problem CodeChef: Practical coding for everyone ?
Thank you very much.

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

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

Do these two and you will get the answer
:slight_smile:

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