Don Mahurin
update README
9c30a5b
raw
history blame contribute delete
334 Bytes
#!/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)