The Brave Sir Robin's cAsE cOrReCtOr

No attempts yetTime limit1sMemory limit128 MB

Problem

Three tireless minstrels follow the brave knight Sir Robin everywhere he goes, singing at the top of their lungs about deeds he would rather forget. Sir Robin cannot make them change a word. They handed him printed transcripts of the songs and cheerfully announced that the lyrics are final.

So Sir Robin studied the transcripts and noticed that the loudest parts are written in capital letters. He cannot change the words, but he can lower the volume, and he can insist on proper usage of the King's English while he does it. Capital letters become small letters, except where the King's English demands a capital.

Sir Robin is strangely reluctant to do the work himself, so he asks you to write a program that makes a first pass over a song. Corrections will still be needed after the program runs.

Your program reads the text and decides the case of every letter. Look back from the letter and skip white space and the parentheses ( and ). If the first character you meet that way is terminal punctuation, that is a period, a question mark or an exclamation point, the letter is forced to upper case. Every other letter is forced to lower case, including a letter with no such character in front of it at all. A period inside a decimal number such as 3.14 has a digit right after it, so it does not start a new sentence, and a number is followed by an upper case letter only when the number itself ends with terminal punctuation. Characters that are not letters are copied unchanged.

Input

The input is the text to convert. Read it to the end of the file. It may span several lines and may contain letters, digits, punctuation, parentheses and white space.

Output

Print the converted text. Every character of the input appears in the output in the same order and at the same position, and only the case of letters changes.