#include <stdio.h>
#include <string.h>
int main() {
char str[65536];
int strLen;
int head;
int tail;
int index;
gets(&str);
tail = head = strlen(&str) - 1;
for(head; head >= -1; ) {
if(head != -1 && str[head] != ' ') {
head--;
} else {
if(tail != head) {
for(index = head + 1; index <= tail; index++) {
printf("%c", str[index]);
}
printf(" ");
head--;
tail = head;
}
}
}
return 0;
}