import re
s=open(0).read();m={};j={}
for x in re.finditer(r'\w+',s):
\x09w=x.group().lower()
\x09if w in m:j[x.end()]=m[w].end()
\x09m[w]=x
i=0
while i<len(s):
\x09if i in j:n=j[i];del j[i];i=n
\x09print(end=s[i]);i+=1
Note that non-ascii characters in the above source code will be escaped (such as \x9f).