
71  ZOJ Monthly, October 2008  Painting
When Vitta was a little girl, she had a dream, that is, to be an excellent painter! But as she entered university, she has no more time to do it. One day, to kill the boring time, she thinks up a game to play with Winsty. First, she picks a number, then she draws the LED representation (see the following picture for detail) of it on a paper, and writes a sequence of the drawing steps. At first, she puts her pen on the paper. If she moves up her pen, she will write a letter 'U'. The same it goes, 'D' for down, 'L' for left, 'R' for right. Besides, if she let her pen leave the paper, she will write a letter 'u', and when she puts it down again, she will write 'd'. She sends the entire sequence to Winsty, and let he guess the number she paints. But Vitta finds that Winsty replies so quickly, and finally she discovers the secret: Winsty wrote a program to solve it! Now Vitta wants the magical program too, and it is your turn to help her. Input One line for each case, the sequence constituted by letter 'UDLRud'. The length of the sequence is less and shorter than 50. We assume that:
Output One line for each case, the resulting number. Sample Input UULLDDDDRRUUUU UuLdDRD UU Sample Output 0 4 1 Author: WANG, Naiyan 