#K93352. Encrypting Sentences
Encrypting Sentences
Encrypting Sentences
Given a sentence, your task is to encrypt it by performing the following two operations:
- Reverse each word in the sentence.
- Reverse the order of the words in the sentence.
For example, if the input sentence is hello world this is encryption
, then after reversing each word you get olleh dlrow siht si noitpyrcne
and finally by reversing the order of the words the encrypted sentence becomes noitpyrcne si siht dlrow olleh
.
In mathematical terms, if the sentence is represented as a sequence of words \(w_1, w_2, \ldots, w_n\), then the transformation is:
\[ result = reverse(w_n^{rev}, w_{n-1}^{rev}, \ldots, w_1^{rev}) \]
where \(w_i^{rev}\) denotes the reversal of the i-th word.
inputFormat
The input consists of a single line containing the sentence to be encrypted. The sentence contains one or more words separated by spaces.
outputFormat
Print the encrypted sentence as described in the problem statement.
## samplehello world this is encryption
noitpyrcne si siht dlrow olleh