Starting the cut from ith character taking temporary node pointer for checking whether the subString [ i , j ) is present in trie of not
TrieNode temp = root ; for ( int j = i + 1 ; j <= n1 ; j ++ ) { if ( temp . child [ S1 . charAt ( j - 1 ) - ' a ' ] == null )