#K48077. Final Temperature and Concentration
Final Temperature and Concentration
Final Temperature and Concentration
You are given an initial temperature \(T_0\) and an initial concentration (in percentage) \(C_0\). Then, you are provided with a sequence of actions represented as a string. Each character in the string corresponds to an operation that adjusts the temperature or concentration as follows:
- W: Increase the temperature by 1.
- C: Decrease the temperature by 1.
- A: Increase the concentration by 1.
- D: Decrease the concentration by 1.
Your task is to calculate the final temperature and concentration after processing all the actions. The formula for processing is straightforward: for each action character in the provided string, update the values accordingly. Note that the concentration is represented in percentage and the temperature as an integer value.
For example, if \(T_0 = 20\), \(C_0 = 50\) and the actions are "WCAADDC", after processing all the actions the final temperature and concentration will be \(19\) and \(50\), respectively.
inputFormat
The input consists of two lines:
- The first line contains two space-separated integers \(T_0\) and \(C_0\) representing the initial temperature and concentration respectively.
- The second line is a string consisting of the actions. It may be empty.
Input is provided via standard input (stdin).
outputFormat
Print a single line containing two integers separated by a space: the final temperature and the final concentration after processing all the actions. Output is written to standard output (stdout).
## sample20 50
WCAADDC
19 50