+ 1

The program print the count of characters which are repeated in next n characters. Help me to solve this

Input abcddcba 5 Output: 6 (repeated) Explanation: The character a at index 0 is not repeated within the next 5 characters or previous 5 characters. The character b at index 1 is repeated within the next 5 characters. The character c at index 2 is repeated within the next 5 characters. The character d at index 3 is repeated within the next 5 characters. The character d at index 4 is repeated within the previous 5 characters. The character cat index 5 is repeated within the previous 5 characters. The character b at index 6 is repeated within the previous 5 characters. The character a at index 7 is not repeated within the next 5 characters or previous 5 characters.

28th Feb 2019, 2:12 PM
Muralikrishnan
Muralikrishnan - avatar
1 Resposta
+ 3
Then? What is the problem?
28th Feb 2019, 2:15 PM
KrOW
KrOW - avatar