m@main=getLine>>=putStrLn.foldl1(flip$map.(#)).words>>m l#c|[e]<-filter(/=c)l=e|1>0=c