英语翻译Since today is so special,ZOJ would only accept a specia

英语翻译
Since today is so special,ZOJ would only accept a special kind of strings to pass its tests.The AC rules are given as the following:
1.there are only three distinct capital letters of the strings:Z,O,and J;
2.any string that is in the form xZOJxO is acceptable,where x is a string either empty or composed of O's only;
3.if aZbJc is acceptable,then aZbOJcO is acceptable,where a,b and c are all strings either empty or composed of O's only.
Now it is your job to write a special judge program to tell if an input string is an AC string.
Input
The input consists of multiple test cases,each occupies a line containing the input string with length greater than 1 and less than 100.The string consists of only 'Z','O',and 'J'.Proceed until the end of file.
Output
For each test case,print in a line "Accepted" if the string is acceptable,or "Wrong Answer" if not.
Sample Input
ZOJO
OZOJOO
OZOOJOOO
OZOZOJOO
OOZOOJO
Sample Output
Accepted
Accepted
Accepted
Wrong Answer
Wrong Answer
zimuayng 1年前 已收到2个回答 举报

cdxumin 春芽

共回答了11个问题采纳率:100% 举报

由于今天是如此特殊,ZOJ将只接受一种特殊的字符串通过其测试.给出的交流规则如下:
1.只有3个不同的大写字母的字符串:ž,澳,和J;
2.任何字符串的形式xZOJxO是可以接受,其中x是一个字符串或者空或由O的使用;
3.如果aZbJc是可以接受的,那么aZbOJcO是可以接受的,其中A,B和C都是字符串或空或O的唯一组成.
现在是你的工作写一个特别程序来告诉法官,如果输入的字符串是一个交流的字符串.
输入
输入多个测试案例组成,每行包含一个占地不到的长度大于1的输入字符串100.该字符串只包含的'Z','澳'和'J'来.继续,直到文件结尾.
产量
对于每个测试用例,打印行“接受”,如果字符串是可以接受的,或“错误的答案”,如果没有.
样本输入
增上
OZOJOO
OZOOJOOO
OZOZOJOO
OOZOOJO
示例输出
公认
公认
公认
错误的答案
错误的答案

1年前

7

congcong179 幼苗

共回答了51个问题 举报

自从今天是特别的地方,ZOJ只会接受一种特殊的字符串通过它的测试。管委会规则进行了如下:


世界上只有三个不同准备的大写字母串:Z、阿、和J。
2.任何的字符串的形式是可接受的,xZOJxO x是一个字符串或者空或由O唯一的。
如果aZbJc来讲是可以接受的,那么aZbOJcO是可接受的,在那里,b和c是所有字符串或者空或由O唯一的。

1年前

0
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 17 q. 0.034 s. - webmaster@yulucn.com