Driver code
int main ( ) { struct TrieNode * root = getNode ( ) ; string dictionary [ ] = { " sam " , " sung " , " samsung " } ; int n = sizeof ( dictionary ) / sizeof ( string ) ; for ( int i = 0 ; i < n ; i ++ ) { insert ( root , dictionary [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { cout << dictionary [ i ] << " : ▁ STRNEWLINE " ; wordBreakAll ( root , dictionary [ i ] , dictionary [ i ] . length ( ) , " " ) ; } return 0 ; }