For every uppercase letter found map that uppercase to original words
if ( words . get ( i ) . charAt ( j ) >= ' A ' && words . get ( i ) . charAt ( j ) <= ' Z ' ) { str += words . get ( i ) . charAt ( j ) ; map . put ( str , list ( map . get ( str ) , words . get ( i ) ) ) ; } } } boolean wordFound = false ;