Problem B
Digit Translation
You are given a string of lowercase letters. In one operation, if you can find a substring that is one of the written-out forms of one of the digits from zero to nine (“zero”, “one”, “two”, “three”, “four”, “five”, “six”, “seven”, “eight”, “nine”), you can replace that substring with the numeric digit.
Your goal is to find the shortest possible string you can end up with after applying zero or more of these operations, as well as how many distinct strings of that length there are.
Input
The single line of input contains a string of lowercase letters with length at least one and at most $10^6$.
Output
Output two separate lines.
On the first line output a single integer, which is the length of the shortest possible string.
On the second line output a single integer, which is the number of distinct strings of that length that can be obtained after applying zero or more of the specified operations, modulo 9302023.
Sample Input 1 | Sample Output 1 |
---|---|
icecreamcone |
10 1 |
Sample Input 2 | Sample Output 2 |
---|---|
onetwo |
2 1 |
Sample Input 3 | Sample Output 3 |
---|---|
twone |
3 2 |