<>; for(<>){ @a=/./g; for$c(a..z){ $h{join"",sort@a,$c}+=1; } } for(keys%h){ if($h{$_}==1){ print; exit; } } print-1;