306736: CF1245C. Constanze's Machine

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Constanze's Machine

题意翻译

## 题目描述 $Constanze$是全村最聪明的女孩,但是她视力不好 一天,她发明了一台神奇的机器。当你念字母时,机器会把它们写刻在一张纸上。举个例子,如果你按这个顺序念“$c$”、“$o$”、“$d$”和“$e$”,那么机器就会在纸上写“$code$”。多亏了这台机器,她终于不用眼镜就能写信了 但是,她的朋友$Akko$决定对她开个玩笑,$Akko$改了机器,如果你念$w$,它会写$uu$而不是$w$,如果你念$m$,它会写$nn$而不是$m$。由于$Constanze$视力不好,她不知道$Akko$做了什么 其他字母和以前一样:如果你念的是“$w$”,“$m$”以外的字母,机器就会把它原封不动地写在纸上 第二天,我在邮箱里收到了一封信。但我看不懂,我想这应该是$Constanze$用她的机器写的。但既然我知道$Akko$做了什么,我就可以把$Constanze$的机器写的话变成我原本可能得到的信息。 但是因为我很菜,所以我要向你求助。你需要告诉我告诉我所有原本可能得到的信息有多少种。 由于答案可能很大,请输出答案对$10^9+7$取模后的结果。 如果没有一个字符串经过$Constanze$的机器后能得到我的结果,请输出$0$ ## 输入格式 一个字符串$s(1\le\left|s\right|\le10^5)$,表示我收到的信息,$s$只包含小写字母。 ## 输出格式 输出我所有原本可能得到的信息有多少种(即多少个字符串经过机器后能得到我收到的信息),对$10^9+7$取模。 ## 说明/提示 对于第一个样例,可能的字符串如下:“$ouokarin$”、“$ouokarim$”、“$owokarim$”和“$owokarin$” 第二个样例只有一个:“$banana$” 对于第三个样例,可能的字符串如下:“$nm$”、“$mn$”和“$nnn$” 在最后一个样例中,没有任何字符串可以被机器转换成“$amanda$”,因为机器不会写下“$m$”。

题目描述

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 consists of a single line containing a string $ s $ ( $ 1 \leq |s| \leq 10^5 $ ) — the received message. $ s $ contains only lowercase Latin letters.

输出格式


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

输入输出样例

输入样例 #1

ouuokarinn

输出样例 #1

4

输入样例 #2

banana

输出样例 #2

1

输入样例 #3

nnn

输出样例 #3

3

输入样例 #4

amanda

输出样例 #4

0

说明

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

题意翻译

## 题目描述 $Constanze$是全村最聪明的女孩,但是她视力不好 一天,她发明了一台神奇的机器。当你念字母时,机器会把它们写刻在一张纸上。举个例子,如果你按这个顺序念“$c$”、“$o$”、“$d$”和“$e$”,那么机器就会在纸上写“$code$”。多亏了这台机器,她终于不用眼镜就能写信了 但是,她的朋友$Akko$决定对她开个玩笑,$Akko$改了机器,如果你念$w$,它会写$uu$而不是$w$,如果你念$m$,它会写$nn$而不是$m$。由于$Constanze$视力不好,她不知道$Akko$做了什么 其他字母和以前一样:如果你念的是“$w$”,“$m$”以外的字母,机器就会把它原封不动地写在纸上 第二天,我在邮箱里收到了一封信。但我看不懂,我想这应该是$Constanze$用她的机器写的。但既然我知道$Akko$做了什么,我就可以把$Constanze$的机器写的话变成我原本可能得到的信息。 但是因为我很菜,所以我要向你求助。你需要告诉我告诉我所有原本可能得到的信息有多少种。 由于答案可能很大,请输出答案对$10^9+7$取模后的结果。 如果没有一个字符串经过$Constanze$的机器后能得到我的结果,请输出$0$ ## 输入格式 一个字符串$s(1\le\left|s\right|\le10^5)$,表示我收到的信息,$s$只包含小写字母。 ## 输出格式 输出我所有原本可能得到的信息有多少种(即多少个字符串经过机器后能得到我收到的信息),对$10^9+7$取模。 ## 说明/提示 对于第一个样例,可能的字符串如下:“$ouokarin$”、“$ouokarim$”、“$owokarim$”和“$owokarin$” 第二个样例只有一个:“$banana$” 对于第三个样例,可能的字符串如下:“$nm$”、“$mn$”和“$nnn$” 在最后一个样例中,没有任何字符串可以被机器转换成“$amanda$”,因为机器不会写下“$m$”。

加入题单

算法标签: