import sys

for line in sys.stdin:
	lst = []
	line = line.split()
	for word in line:
		if len(word) == 1:
			lst.append(word)
		else:
			lst.append(word[0] + word[-2:0:-1] + word[-1])
	print ' '.join(lst)

	