var
s,s1, slovo: string;
i,k,n:integer;
begin
Readln(s);
k:=1;
n:=length(s);
s1:=s;
for i:=1 to n do
if (s[i]=' ')or(i=n) then
begin
slovo := copy(s,k,i-k);
if slovo[1]=slovo[length(slovo)]
then delete(s1,pos(slovo,s1),length(slovo)+1);
k:=i+1;
end;
writeln(s1);
Readln
end.