AT_abc394_c [ABC394C] Debug

Description

You are given a string $ S $ consisting of uppercase English letters. Apply the following procedure to $ S $ , and then output the resulting string: > As long as the string contains `WA` as a (contiguous) substring, repeat the following operation: > > - Among all occurrences of `WA` in the string, replace the leftmost one with `AC`. It can be proved under the constraints of this problem that this operation is repeated at most a finite number of times.

Input Format

The input is given from Standard Input in the following format: > $ S $

Output Format

Print the resulting string after performing the procedure described in the problem statement on $ S $ .

Explanation/Hint

### Sample Explanation 1 Initially, the string is $ S= $ `WACWA`. This string contains `WA` as a substring in two places: from the 1st to the 2nd character, and from the 4th to the 5th character. In the first operation, we replace the leftmost occurrence (the substring from the 1st to the 2nd character) with `AC`, resulting in `ACCWA`. After the first operation, the string contains `WA` as a substring in exactly one place: from the 4th to the 5th character. In the second operation, we replace it with `AC`, resulting in `ACCAC`. Since `ACCAC` does not contain `WA` as a substring, the procedure ends. Therefore, we output `ACCAC`. ### Sample Explanation 2 Initially, the string is $ S= $ `WWA`. This string contains `WA` as a substring in exactly one place: from the 2nd to the 3rd character. In the first operation, we replace it with `AC`, resulting in `WAC`. Then, after the first operation, the string contains `WA` in exactly one place: from the 1st to the 2nd character. In the second operation, we replace it with `AC`, resulting in `ACC`. Since `ACC` does not contain `WA` as a substring, the procedure ends. Therefore, we output `ACC`. ### Sample Explanation 3 Since $ S $ does not contain `WA` as a substring from the start, no operations are performed and the procedure ends immediately. Therefore, we output `WWWWW`. ### Constraints - $ S $ is a string of uppercase English letters with length between 1 and $ 3\times 10^5 $ , inclusive.