#294. 条件字符删除与字符串处理
条件字符删除与字符串处理
Conditional Character Removal
Background
Congcong is learning string processing and encountered an interesting problem.
Problem Description
Given a string, return a version without the first 2 characters. However, keep the first character if it is 'a', and keep the second character if it is 'b'. The string can be of any length.
Input Format
Input is given from standard input in the following format.
A string.
Output Format
Output is printed to standard output in the following format.
The processed string.
Sample
Hello
"llo"
java
"va"
away
"aay"
Sample Explanation
For the first sample Hello: The first character 'H' is not 'a', and the second character 'e' is not 'b', so both first two characters are removed, resulting in "llo".
For the second sample java: The first character 'j' is not 'a', and the second character 'a' is not 'b', so both first two characters are removed, resulting in "va".
For the third sample away: The first character 'a' is 'a', so it is kept. The second character 'w' is not 'b', so it is removed. The final result is "aay".
Constraints
Time limit: 1 second per test case. Memory limit: 1024 KiB per test case.