var s,t:string(999);begin repeat readln(t);t:=t+^j;str(s:pos(t,s+t)-1,t,copy(s,pos(t,s+t)),s)until eof;write(s)end.