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:
- there are only three distinct capital letters of the strings: Z, O, and J;
- any string that is in the form xZOJxO is acceptable, where x is a string either empty or composed of O's only;
- 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.
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.
For each test case, print in a line "Accepted" if the string is acceptable, or "Wrong Answer" if not.
- caozhy 2017.09.14 23:49