#!/usr/bin/env python3 | |
# reverses word and punctuation order. | |
import re | |
import sys | |
lines = [] | |
for line in sys.stdin: | |
#line = " ".join(reversed(line.rstrip().split(" "))) | |
line = ''.join(reversed(re.split('([\w\d\']+|\.|"|\?|\!|,)', line.rstrip()))) | |
lines.append(line) | |
lines.reverse() | |
for line in lines: | |
print(line) | |