CF1245C.Constanze's Machine

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 109+710^9+7.

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

康斯坦泽是她村子里最聪明的女孩,但她视力很差。

一天,她发明了一台令人惊叹的机器!当你发出字母的读音时,这台机器就会将该字母写在纸上。例如,如果你依次发出 'c'、'o'、'd'、'e' 的读音,那么机器就会在纸上写下 "code"。多亏了这台机器,她终于可以不戴眼镜就书写信息了。

然而,她那个笨朋友阿克科决定捉弄她一番。阿克科偷偷改装了这台机器:当你发出 'w' 的读音时,机器会写下 "uu" 而非 "w";当你发出 'm' 的读音时,机器会写下 "nn" 而非 "m"!由于康斯坦泽视力不好,她没能察觉阿克科做了什么。

其余所有字母的行为都与原来一样:如果你发出除 'w' 和 'm' 外的任意字母的读音,机器就直接将该字母写在纸上。

第二天,我收到了一封寄到我家信箱的信。我完全看不懂它,因此推测这要么是阿克科胡乱写的无意义文字,要么是康斯坦泽用她的机器写成的。但既然我知道阿克科做了什么改动,我只需列出所有可能被康斯坦泽的机器转换成我收到的这封信的原始字符串,再看看其中是否有有意义的内容即可。

不过,我需要知道将要消耗多少纸张,因此向你求助:请告诉我,有多少种不同的原始字符串,能被康斯坦泽的机器转换成我收到的这封信?

但由于这个数目可能非常大,请你输出它对 109+710^9+7 取模的结果。

如果不存在任何能被康斯坦泽的机器转换成我收到的这封信的原始字符串,则输出 00。

输入格式

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

输入包含一行,其中为一个字符串 ss(1≤∣s∣≤1051 \leq |s| \leq 10^5)——即接收到的消息。ss 仅包含小写拉丁字母。

输出格式

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

输出一个整数——Constanze 的机器可能生成消息 ss 的字符串数量,对 109+710^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'.

对于第一个例子,候选字符串如下:“ouuokarinn”、“ouuokarim”、“owokarim”和“owokarinn”。

对于第二个例子,只有一个候选字符串:“banana”。

对于第三个例子,候选字符串如下:“nm”、“mn”和“nnn”。

对于最后一个例子,不存在机器能够转换为“amanda”的候选字符串,因为该机器不会刻印字母‘m’。

输入解题思路,AI测评打分。不知道怎么写?

首页