12709 - reverse order and case for alphabets of word   

Description

There are two tasks in this problem:

  1. Reverse ONLY the order of alphabets for each word. (abc -> cba)

  2. Reverse the alphabet cases for each word. (ABC -> abc, abc -> ABC)

 

Note that

  1. 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.
  2. 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

Sample Input  Download

Sample Output  Download

Tags




Discuss