var
s: string;
begin
readln(s); //s := 'Привет дорогой мир шалаш кроет';
write('a) ');
foreach s1: string in s.Split(' ') do
write(s1.last());
write(#13 + 'b) ');
foreach s1: string in s.Split(' ') do
begin
var b: boolean := true;
var i: byte := 1;
while (i <= length(s1) / 2) and b do<br> begin
b := (s1[i] = s1[length(s1) - i + 1]);
Inc(i);
end;
if (not b) then
write(s1, ' ');
end;
end.