2 shunfurh shunfurh 于 2017.08.30 01:15 提问

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个回答

caozhy
caozhy   Ds   Rxr 2017.09.14 23:49
已采纳
Csdn user default icon
上传中...
上传图片
插入图片