Driver code
public static void main ( String [ ] args ) { HashSet < String > dict = new HashSet < String > ( ) ; dict . add ( " abb " ) ; dict . add ( " abc " ) ; dict . add ( " xyz " ) ; dict . add ( " xyy " ) ; String pattern = " foo " ; findMatchedWords ( dict , pattern ) ; } }