String Rank
시간 제한0.5초메모리 제한2048 MB
문자열의 모든 접미사가 길이 t 이하의 서로 다른 부분수열 집합을 갖게 하는 최소 t를 구한다.
문제
Let and be strings consisting of the English lowercase alphabet. We say that a string is a subsequence of a string if there exists a strictly increasing sequence of integers , where , and for all . Here, denotes the -th character of the string . Let denote the suffix . If , then is the empty string denoted by .
Given a nonempty string and a positive integer , we define the -set of to be the set of subsequences of whose lengths are . This implies that, for any string , the empty string belongs to by definition.
For example, when aaba, we have aaba) = \\{\lambda, a, b, ba, ab, aa, aba, aab, aaa\\}.
For a string , we define the rank of to be the minimum integer such that the -sets for all suffixes of are all different. In other words, the rank of is .
For instance, when aaba, the -sets aba and aaba are equal. On the other hand, for , we have
- ,
a) = \\{\lambda,a\\},ba) = \\{\lambda,a,b,ba\\},aba) = \\{\lambda,a,b,ba,ab,aa,aba\\},aaba) = \\{\lambda,a,b,ba,ab,aa,aba,aab,aaa\\}.
Therefore, the rank of the string aaba is .
Given a string , write a program to output its rank.
입력
Your program is to read from standard input. The input consists of a single nonempty string , which consists only of lowercase characters from the English alphabet. The length of the string is at most .
출력
Your program is to write to standard output. Print exactly one line. The line should contain a positive integer to represent the rank of the input string .