PROGRAMMING:Catch a mouse ~ lose or gain?
In a certain place, rats are in a disaster. Now we offer a reward of 10 yuan for each mouse we catch, so we begin to fight with the rats: you can choose the following three operations in the corner every day: put a mousetrap with a piece of cheese (` t '), put a piece of cheese (` C'), or put nothing (` X '). The mousetrap can be reused. Regardless of the cost, the cheese is 3 yuan per piece< br>
What about the smart mouse? They may send a mouse to the corner every day to see what's in the corner
-If there is nothing (` X '), the mice will be unhappy, and there will be a period of unhappiness as long as one day (that is, the next day). Don't send rats when you're not happy. At the end of the unhappy period, rats were sent.
-If there is a mousetrap (` t '), the mouse is lured to eat the cheese and killed (dead), the mice will have a sad period of up to two days (that is, the second and third days). In the sad period, do not send mice. At the end of the sad period, rats were sent out** In this case, catching a mouse can get a reward of 10 yuan, but it also costs a piece of cheese. Note that if a rat trap is placed one day but the mouse does not appear, no cheese is consumed**
-If there is cheese (` C '), mice will be very happy to eat it, There will be an exciting period of up to two days (the second and the third). During the excitement, even if the superposition of unhappy or sad, it must send mice** In this case, no mice were caught and a piece of cheese was consumed. Note that if the cheese is placed one day but the mouse does not appear, the cheese can be reused next time without consumption**
Now I'll give you the operation sequence for several consecutive days, and it's known that rats will be sent out on the first day. Please judge the state of rats every day and calculate the profit.
###Input format:
Enter a string of no more than 70 characters in a row, consisting of 'C' or't 'or' x ', ending with' $'. Each character in the string represents the operation of the day (i.e. 'x': nothing to put` T ': rat trap` C: put the cheese. The title guarantees at least one day of operation input.
###Output format:
It is required to output a continuous string on the first line, corresponding to the input, and give the status of the mouse:
- `!` Send the mice to eat the cheese
-"D" means to send mice to be killed
-"U" means nothing for the mice
-"-" means no mice were sent
The second line should output a whole number to show the profit( If there is a loss, it is negative.)
###Input sample 1:
```in
TXXXXC$
```
###Output sample 1:
```out
D--U-!
four
```
###Input sample 2:
```
CTTCCX$
```
###Output sample 2:
```
! DD--U
eleven
```
answer:If there is no answer, please comment
What about the smart mouse? They may send a mouse to the corner every day to see what's in the corner
-If there is nothing (` X '), the mice will be unhappy, and there will be a period of unhappiness as long as one day (that is, the next day). Don't send rats when you're not happy. At the end of the unhappy period, rats were sent.
-If there is a mousetrap (` t '), the mouse is lured to eat the cheese and killed (dead), the mice will have a sad period of up to two days (that is, the second and third days). In the sad period, do not send mice. At the end of the sad period, rats were sent out** In this case, catching a mouse can get a reward of 10 yuan, but it also costs a piece of cheese. Note that if a rat trap is placed one day but the mouse does not appear, no cheese is consumed**
-If there is cheese (` C '), mice will be very happy to eat it, There will be an exciting period of up to two days (the second and the third). During the excitement, even if the superposition of unhappy or sad, it must send mice** In this case, no mice were caught and a piece of cheese was consumed. Note that if the cheese is placed one day but the mouse does not appear, the cheese can be reused next time without consumption**
Now I'll give you the operation sequence for several consecutive days, and it's known that rats will be sent out on the first day. Please judge the state of rats every day and calculate the profit.
###Input format:
Enter a string of no more than 70 characters in a row, consisting of 'C' or't 'or' x ', ending with' $'. Each character in the string represents the operation of the day (i.e. 'x': nothing to put` T ': rat trap` C: put the cheese. The title guarantees at least one day of operation input.
###Output format:
It is required to output a continuous string on the first line, corresponding to the input, and give the status of the mouse:
- `!` Send the mice to eat the cheese
-"D" means to send mice to be killed
-"U" means nothing for the mice
-"-" means no mice were sent
The second line should output a whole number to show the profit( If there is a loss, it is negative.)
###Input sample 1:
```in
TXXXXC$
```
###Output sample 1:
```out
D--U-!
four
```
###Input sample 2:
```
CTTCCX$
```
###Output sample 2:
```
! DD--U
eleven
```
answer:If there is no answer, please comment