Namomo Subsequence
시간 제한3초메모리 제한1024 MB
문자열에서 문자 간 같은지 다른지의 패턴이 namomo와 같은 길이 6 부분수열의 개수를 998244353으로 나눈 나머지로 구한다.
문제
"gshfd1jkhaRaadfglkjerVcvuy0gf" said Prof. Pang.
To understand Prof. Pang's word, we would like to calculate the number of namomo subsequences of it. The word by Prof. Pang is a string with characters where each character is either an English letter (lower or upper case) or a digit. The -th character of is denoted by (). A subsequence of is defined by a list of indices such that . Let be a function on two characters such that when and otherwise. is a namomo subsequence of if and only if for any , , where represents the -th character of the string "namomo" ().
Output the number of namomo subsequences of a given string modulo .
입력
The first line contains a string with characters (). contains only lower case English letters ('a' -- 'z'), upper case English letters ('A' -- 'Z') and digits ('0' -- '9').
출력
Output one integer -- the answer modulo .