当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3073:Spam

题目描述

To thwart content-based spam filters, spammers often modify the text of a spam email to prevent its recognition by automatic filtering programs. For any plain text string s (containing only upper-case letters), let Φ(s) denote the string obtained by substituting each letter with its “spam alphabet” equivalent:

A4(four)N|\|(pipe backslash pipe)
B|3(pipe three)O0(zero)
C((left-parenthesis)P|0(pipe zero)
D|)(pipe right-parenthesis)Q(,)(left-parenthesis comma right-parenthesis)
E3(three)R|?(pipe question-mark)
F|=(pipe equals)S5(five)
G6(six)T7(seven)
H#(pound)U|_|(pipe underscore pipe)
I|(pipe)V\/(backslash forward-slash)
J_|(underscore pipe)W\/\/(backslash forward-slash backslash forward-slash)
K|<(pipe less-than)X><(greater-than less-than)
L|_(pipe underscore)Y-/(minus forward-slash)
M|\/|(pipe backslash forward-slash pipe)Z2(two)

In this scheme, any plain text message s corresponds to exactly one spam-encoded message Φ(s). The reverse, however, is not necessarily true: a spam-encoded message may correspond to more than one plain text message.

Given a plain text message s, your goal is to determine the number of unique plain text messages whose spam encoding is Φ(s).

输入解释

The input test file will contain multiple test cases. Each test case consists of a single line containing a plain text string s containing from 1 to 100 upper-case letters. The end-of-file is denoted by a single line containing the word “end”.

输出解释

For each test case, print the number of unique plain text messages (including the original message) whose spam encoding is Φ(s). The number of unique plain text messages is guaranteed to be no greater than 1,000,000,000.

输入样例
BU
UJ
THEQUICKBROWNFOXJUMPEDOVERTHELAZYDOGS
end
输出样例
6
5
144
提示

In the first test case, the spam encoding of ‘BU’ is ‘|3|_|’. The 6 plain text messages with this spam encoding are ‘BU’, ‘IEU’, ‘BIJ’, ‘IEIJ’, ‘BLI’, and ‘IELI’. In the second test case, the spam encoding of ‘UJ’ is ‘|_|_|’. The 5 plain text messages with this spam encoding are ‘UJ’, ‘LU’, ‘IJJ’, ‘LLI’, and ‘LIJ’.


该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Stanford Local 2006

源链接: POJ-3073

最后修改于 2020-10-29T06:51:49+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536