longest word and output functions