DWITE
October 2011
Problem 1
Arab-lish Numbers

Arabic is a very peculiar language: unlike English and many others, it is written from right to left. However, the numbers are still written from left to right, and this can cause some problems (especially when the numbers get large). Imagine writing English in this manner (let's call this language "Arab-lish"):

elbat eht no selppa 199 era ereht

The above sentence reads: "there are 199 apples on the table". Notice that the number is still written as 199, not 991. Given sentences written in Arab-lish, translate them to English (keeping in mind the special case for numbers).

The input file DATA1.txt will contain 5 lines of input, each an Arab-lish sentence consisting of alphanumeric words (a-z, A-Z, 0-9) separated by single spaces. Each line is at most 255 characters long.

The output file OUT1.txt will contain 5 lines of output, each an English translation from the corresponding Arab-lish sentence.

Note: in the second test input, the word "abc123" is not a number (it has letter characters), so it is flipped in the translation to "321cba".

Sample Input (only first 2 shown):
 
tsetnoc siht ni snoitseuq 5 era ereht
ABC 123 abc123
		        
Sample Output (only first 2 shown):
 
there are 5 questions in this contest
321cba 123 CBA