编程介的小学生 2017-08-29 17:15 采纳率: 20.5%
浏览 832
已采纳

ZOJ Special AC String

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

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-09-14 15:49
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器