1130 : Happy Robot

时间限制Time Limit 1 Sec 内存限制Memory Limit 128 MB 提交次数Submitted 39 Times 通过次数Solved 20 Times 标准评测Standard Judge

题目描述Description

A robot is moving from (0,0) according to a command sequence. Each character in the sequence is command:

  • L: turn left
  • R: turn right
  • F: go forward one step

Interestingly, the command sequence contains some wildcard character “?”. The robot can treat it any one of L, R or F at its own wish, which makes it really happy.

Let (x,y) be the final position of the robot, your task is to find out the minimal/maximal possible value of x and y. Initially the robot is facing east (i.e. facing (1,0) in Cartesian coordinate system). After a left turn it will face north (i.e. facing (0,1)).

输入格式Input

There will be at most 1000 test cases. Each case contains a command sequence with no more than 1000 characters.

输出格式Output

For each test case, print the case number, followed by minimal/maximal possible x (in this order), then the minimal/maximal possible y.

样例Sample

出题Author

SRbGa