#163. F

    ID: 163 传统题 1000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>去年校赛洛谷字符串动态规划模运算组合计数

F

F

题目描述

As we all know, Fat Brother likes MeiZi every much, he always find some topic to talk with her. But as Fat Brother is so low profile that no one knows he is a rich-two-generation expect the author, MeiZi always rejects him by typing “hehe” (wqnmlgb). You have to believe that there is still some idealized person just like Fat Brother. They think that the meaning of “hehe” is just “hehe”, such like “hihi”, “haha” and so on. But indeed sometimes “hehe” may really means “hehe”. Now you are given a sentence, every “hehe” in this sentence can replace by “wqnmlgb” or just “hehe”, please calculate that how many different meaning of this sentence may be. Note that “wqnmlgb” means “我去年买了个表” in Chinese.

输入说明

The first line contains only one integer T, which is the number of test cases.
Each test case contains a string means the given sentence. Note that the given sentence just consists of lowercase letters.

输出说明

For each test case, output the case number first, and then output the number of the different meaning of this sentence may be. Since this number may be quite large, you should output the answer modulo 10007.

 

样例

输入

5
wanshangniyoukongme
womenyiqichuqukanxingxingba
bulehehewohaiyoushi
panggeshuotayaoqukaogongwuyuanjiubulainuenimenlehehe
eheheheh

输出

Case 1: 1
Case 2: 1
Case 3: 2
Case 4: 2
Case 5: 3

提示

T<=100

The lenth of each sentence <= 10086