puts [regsub -all (?n)^(.)(.*)(.) [read stdin] {\3\2\1}]