Re-verse
InterviewTime limit1sMemory limit512 MB
Given a song string of length N, find the maximum number of start seconds from 0 to N-1 where the song can be sung so that overlapping shouted letters agree.
- Level
Medium5 of 10
- Topics
- String matching, Math
- Solved
- No attempts yet
문제
What is the maximum number of times Siyi can start singing?
Siyi spends time peacefully doing competitive programming and decides to sing a round song. The song Siyi wants to sing is a string of uppercase English letters.
From second until any time Siyi wants, she shouts one letter every second. The time spent shouting a letter can be ignored. If the string made by joining the letters Siyi shouted from second up to just before second matches the song, Siyi has started singing at second .
Siyi starts singing at second , and can start singing again at every second from up to just before second .
What is the maximum number of times Siyi can start singing?
Input
The first line gives , the length of the string that represents the song Siyi wants to sing.
The second line gives the string that represents the song.
Output
Print the maximum number of times Siyi can start singing on the first line.
Constraints
- The song contains only uppercase English letters.