Pro.ID21520 TitleDance Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21520 AC0 Submit0 Ratio- 时间&空间限制描述For a dance to be proper in the Altered Culture of Machinema, it must abide by the following rules: 1. A dip can only appear 1 or 2 steps after a jiggle, or before a twirl, as in:
2. All dances end with a clap stomp clap. 3. If a dance contains a twirl, it must have a hop. 4. No dance can start with a jiggle. 5. All dances must have a dip. As instructor at a dance composition school, you must grade many freshman attempts at composing dances. You decide to make an automatic grader that can check against these rules. 输入The input consists of a number of dances, one per line. Each dance has a maximum of 1000 steps. Each step is separated by a single space, and all steps are lowercase alphabetic words at most 100 letters long. 输出Description For a dance to be proper in the Altered Culture of Machinema, it must abide by the following rules: 1. A dip can only appear 1 or 2 steps after a jiggle, or before a twirl, as in:
2. All dances end with a clap stomp clap. 3. If a dance contains a twirl, it must have a hop. 4. No dance can start with a jiggle. 5. All dances must have a dip. As instructor at a dance composition school, you must grade many freshman attempts at composing dances. You decide to make an automatic grader that can check against these rules. Input The input consists of a number of dances, one per line. Each dance has a maximum of 1000 steps. Each step is separated by a single space, and all steps are lowercase alphabetic words at most 100 letters long. Output If a dance in the input has no mistakes, then the output should contain the words "form ok: " followed by the original composition. If a dance has a single type of form error, then the output should contain the words "form error K: " where K is the rule which failed, followed by the composition. If a dance has multiple types of form errors, then the output should contain the errors as a comma separated clause, as in "form errors K(1), K(2), ..., K(N-1) and K(N): " where the form errors are in increasing order, followed by the composition. If a dance has form error 1, every dip in the dance that violates rule 1 should be printed in upper case. Sample Input dip twirl hop jiggle hop hop clap stomp clap Sample Output form ok: dip twirl hop jiggle hop hop clap stomp clap Source 样例输入dip twirl hop jiggle hop hop clap stomp clap 样例输出form ok: dip twirl hop jiggle hop hop clap stomp clap 作者 |