Batman and the Riddler
Time: 1 s
Memory: 125 MB
Memory: 125 MB
Batman found a message from the Riddler, written as a string of lowercase letters of length N. He needs your help to change the string in this way:
Since Batman is lazy help him to output the string based on the above conditions.
- If a character has appeared an odd number of times so far, convert it to lowercase.
- If a character has appeared an even number of times so far, convert it to uppercase.
Since Batman is lazy help him to output the string based on the above conditions.
Input
The first line contains N, the length of the stringThe second line contains the string of length N
Constraint
1 <= N <= 1000
Output
Output a new string
Examples
| Input | Output |
|---|---|
|
6
batman |
batmAn
|
| Input | Output |
|---|---|
|
7
riddler |
ridDleR
|
Notes
In the first example:
- 'b' occured 1 time so far, so it is lowercase: 'b'
- 'a' occured 1 time so far, so it is lowercase: 'a'
- 't' occured 1 time so far, so it is lowercase: 't'
- 'm' occured 1 time so far, so it is lowercase: 'm'
- 'a' occured 2 times so far , so it is uppercase: 'A' because 2 is even
- 'n' occurred 1 time so far, so it is lowercase: 'n'
Problem Info
| Problem ID | 324 |
| Time Limit | 1000 ms |
| Memory Limit | 128000 KB |
| Moderators | Lost_Cause , mhmuhim , raj3100 |
Statistics
Submit
You need to Login or Registration for submit your solution