A string is a finite sequence of lowser-case (non-capital) letters of the English alphabet.Particularly, it may be an empty sequence, i.e. a sequence of 0 letters.By A = BC we denotes that A is a string obtained by concatenation (joining by writing one immediately after another, i.e. without any space, etc.) of the strings B and C (in this order).A string P is a prefix of the string A, if there is a string B, that A = PB.In other words, prefixes of A are the initial fragments of A.In addition, if P ≠ A and P is not an empty string, we say, that P is a proper prefix of A.
문자열은 유한한 소문자 알파벳 나열입니다.특히, 빈 문자열(길이가 0인 문자열)이 있을 수 있습니다.A=BC를 통해서 문자열 A가 B와 C의 concatenation(한 문자열을 다른 한 문자열의 바로 다음에 공백 없이 이어 적는 것)임을 나타냅니다.A=PB를 만족하는 B가 존재한다면 P는 A의 접두사입니다.즉, A의 접두사는 A의 첫 파편들입니다.추가적으로, P ≠ A이고 P의 길이가 0이 아닌 경우, P를 A의 진접두사(proper prefix)라고 합니다.
A string Q is a period of A, If Q is proper prefix of A and A is a prefix (not necessarily a proper one) of the string QQ.
For example, the strings abab and ababab are both periods of the string abababa.
문자열 Q가 A의 진접두사이고 A가 QQ의 접두사(진접두사일 필요는 없음)일 때 Q를 A의 주기라고 합니다.
예를 들어, 문자열 "abab"와 "ababab"는 모두 "abababa"의 주기입니다.
The maximum period of a string A is the longest of its periods or the empty string, If A doesn't have any period.
For example, the maximum period of ababab is abab.
The maximum period of abc is the empty string.
문자열 A의 가장 큰 주기는 A의 가장 긴 주기입니다. 주기가 없다면 빈 문자열입니다.
예를 들어, 문자열 "ababab"의 가장 큰 주기는 "abab"입니다.
예를 들어, 문자열 "abc"의 가장 큰 주기는 빈 문자열입니다.
Write a programme that:
reads from the standard input the string's length and the string itself,
calculates the sum of lengths of maximum periods of all its prefixes,
shagyeong 12일 전
A string is a finite sequence of lowser-case (non-capital) letters of the English alphabet.Particularly, it may be an empty sequence, i.e. a sequence of 0 letters.By A = BC we denotes that A is a string obtained by concatenation (joining by writing one immediately after another, i.e. without any space, etc.) of the strings B and C (in this order).A string P is a prefix of the string A, if there is a string B, that A = PB.In other words, prefixes of A are the initial fragments of A.In addition, if P ≠ A and P is not an empty string, we say, that P is a proper prefix of A.
문자열은 유한한 소문자 알파벳 나열입니다.특히, 빈 문자열(길이가 0인 문자열)이 있을 수 있습니다.A=BC를 통해서 문자열 A가 B와 C의 concatenation(한 문자열을 다른 한 문자열의 바로 다음에 공백 없이 이어 적는 것)임을 나타냅니다.A=PB를 만족하는 B가 존재한다면 P는 A의 접두사입니다.즉, A의 접두사는 A의 첫 파편들입니다.추가적으로, P ≠ A이고 P의 길이가 0이 아닌 경우, P를 A의 진접두사(proper prefix)라고 합니다.
A string Q is a period of A, If Q is proper prefix of A and A is a prefix (not necessarily a proper one) of the string QQ.
문자열 Q가 A의 진접두사이고 A가 QQ의 접두사(진접두사일 필요는 없음)일 때 Q를 A의 주기라고 합니다.
The maximum period of a string A is the longest of its periods or the empty string, If A doesn't have any period.
문자열 A의 가장 큰 주기는 A의 가장 긴 주기입니다. 주기가 없다면 빈 문자열입니다.
Write a programme that:
다음을 만족하는 프로그램을 작성하시오: