sub hangman { @w=split//,pop;@w{@w}=("-")x@w;while($g<8){print@w{@w},$/;<>=~/./;$w{$&}?$w{$&}=$&:$g++;"@w{@w}"!~/-/&&last}$g }