for(w in a<-readLines("stdin")){i=1;while(pmatch(s<-substr(w,1,i),a,0)<1)i=i+1;write(s,1)}