#Lutece1161. Hash On Strings
Hash On Strings
Migrated from Lutece 1161 Hash On Strings
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Given a string and a substring of . Please tell me the lexicographical order of among all the substrings of .
If B has multiple lexicographical orders, tell me the smallest one.
For example. A="abab". A has 10 substrings. They are:
- a
- a
- ab
- ab
- aba
- abab
- b
- b
- ba
- bab
If B="a", B ranks 1 and 2, so the smallest answer is 1.
If B="ab", B ranks 3 and 4, so the smallest answer is 3.
If B="bab", B ranks 10, so the answer is 10.
Input
The first line contains a string . The length of is at least and at most . It only contains lower-case letters ('a'-'z').
The second line contains a non-empty string . It is guaranteed that is a substring of .
Output
Output an integer representing the lexicographical order of B among all the substrings of .
If B has multiple lexicographical orders, tell me the smallest one.
Samples
abab
ab
3
Resources
2015 UESTC ACM Summer Training Team Selection (4)