12709 - reverse order and case for alphabets of word
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
Description
There are two tasks in this problem:
-
Reverse ONLY the order of alphabets for each word. (abc -> cba)
-
Reverse the alphabet cases for each word. (ABC -> abc, abc -> ABC)
Note that
- NO non-alphabet char is mixed within a word/token, such as abc777cd, or hel!o. They can only exist at the beginning or end of a word/token.
- You only need to token the line of text with whitespace by the function split() .
You are suggested to use the ord() function to get the index of a character : ord('a') = 97
Input
A line of text
Output
A line of text where each word's alphabet order and case are reversed
Tags