Tudor is learning how to play Dance Dance Revolution!
Tudor is good at stepping to the beat, but is struggling to deal with more complex note patterns. He decides to focus on three-step sequences of notes.
There are four different directions that one can step in Dance Dance Revolution - up, down, left, and right. Note that up and down are in opposite directions, and left and right are in opposite directions. This means there are 64 different three-step sequences of notes.
Tudor is especially interested in crossover sequences or candle sequences. A crossover sequence is a three-step sequence where the first and last steps are opposite, all three steps are in distinct directions, and the first step is either left or right. A candle sequence is a three-step sequence where the first and last steps are opposite, all three steps are in distinct directions, and the first step is either up or down.
Given a particular three-note sequence, determine if it is a crossover sequence, a candle sequence, or neither.
The input consists of exactly one line, containing three uppercase letters, the steps in
sequence in order. Each of these letters will be one of
to up, down, left, and right, respectively.
If the sequence is a crossover sequence, output
Otherwise, if the sequence is a candle sequence, output
Sample Data ZIP
Click here for ZIP.