question: public String longestMatch ( String input ) { TrieNode node = root ; String result = null ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { node = node . getChild ( input . charAt ( i ) ) ; if ( node == null ) break ; if ( node . isTerminal ( ) ) result = input . substring ( 0 , i + 1 ) ; } return result ; }
target:  Returns the longest prefix of <code>input<code> that is matched, or <code>null<code> if no match exists.