Digit Translation

시간 제한1초메모리 제한2048 MB

요약
영어로 적힌 숫자 단어(zero부터 nine까지)를 해당 숫자로 바꾸는 연산을 반복해 얻을 수 있는 가장 짧은 문자열의 길이와, 그 길이를 갖는 서로 다른 문자열의 개수를 구한다.
난이도

어려움10점 중 8점

유형
동적 계획법, 문자열, 문자열 매칭, 조합론
정답자
아직 제출이 없습니다

문제

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.

입력

The single line of input contains a string of lowercase letters with length at least one and at most 10610^6.

출력

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.

예제3

  1. 예제 1

    입력
    icecreamcone
    
    예상 출력
    10
    1
    
  2. 예제 2

    입력
    onetwo
    
    예상 출력
    2
    1
    
  3. 예제 3

    입력
    twone
    
    예상 출력
    3
    2