Updated function for 4 letter word and smallest,largest