// PascalABC.NET 3.6.3
function Cnv(s: string): string;
begin
var n := s.Length;
if s[n] = '.' then begin
s := s[:n];
Dec(n)
end;
if n <= 1 then Result := s</strong>
else
begin
if n.IsOdd then begin
s := s[:n div 2 + 1] + s[n div 2 + 2:];
Dec(n)
end;
Result := s[n] + s[2:n] + s[1]
end
end;
begin
var a := ReadString.ToWords;
a.Select(s -> Cnv(s)).Print
end.