Codeforces Round 597 (Div. 2)
C
Constanze's Machine
Codeforces
1400
原题
← BD →
翻译中…

Constanze is the smartest girl in her village but she has bad eyesight.

翻译中…

One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd', and 'e' in that order, then the machine will inscribe "code" onto the paper. Thanks to this machine, she can finally write messages without using her glasses.

翻译中…

However, her dumb friend Akko decided to play a prank on her. Akko tinkered with the machine so that if you pronounce 'w', it will inscribe "uu" instead of "w", and if you pronounce 'm', it will inscribe "nn" instead of "m"! Since Constanze had bad eyesight, she was not able to realize what Akko did.

翻译中…

The rest of the letters behave the same as before: if you pronounce any letter besides 'w' and 'm', the machine will just inscribe it onto a piece of paper.

翻译中…

The next day, I received a letter in my mailbox. I can't understand it so I think it's either just some gibberish from Akko, or Constanze made it using her machine. But since I know what Akko did, I can just list down all possible strings that Constanze's machine would have turned into the message I got and see if anything makes sense.

翻译中…

But I need to know how much paper I will need, and that's why I'm asking you for help. Tell me the number of strings that Constanze's machine would've turned into the message I got.

翻译中…

But since this number can be quite large, tell me instead its remainder when divided by $10^9+7$.

翻译中…

If there are no strings that Constanze's machine would've turned into the message I got, then print $0$.

翻译中…

Input

翻译中…

Input consists of a single line containing a string $s$ ($1 \leq |s| \leq 10^5$) — the received message. $s$ contains only lowercase Latin letters.

翻译中…

Output

翻译中…

Print a single integer — the number of strings that Constanze's machine would've turned into the message $s$, modulo $10^9+7$.

翻译中…

Note

翻译中…

For the first example, the candidate strings are the following: "ouuokarinn", "ouuokarim", "owokarim", and "owokarinn".

翻译中…

For the second example, there is only one: "banana".

翻译中…

For the third example, the candidate strings are the following: "nm", "mn" and "nnn".

翻译中…

For the last example, there are no candidate strings that the machine can turn into "amanda", since the machine won't inscribe 'm'.

翻译中…

样例

Input #1
ouuokarinn
Output #1
4
InputCopy OutputCopy
Input #2
banana
Output #2
1
InputCopy OutputCopy
Input #3
nnn
Output #3
3
InputCopy OutputCopy
Input #4
amanda
Output #4
0
InputCopy OutputCopy
题目信息
题号
1245C
时间限制
1 s
内存限制
256 MB
标签
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。