String[] dict; void setup() { dict = loadStrings( "words.txt" ); String[] book = loadStrings( "carol.txt" ); book = splitTokens( join( book, " " ), " .,/?!\";:-$&()" ); for ( int idx = 0; idx < book.length; ++idx ) { String word = book[idx].toLowerCase(); if ( !isWord( word ) ) { println( word, word.length() ); } } } boolean isWord( String word ) { for ( int idx = 0; idx < dict.length; ++idx ) { if ( dict[idx].equals( word ) ) { return true; } } return false; }