Driver code
public static void Main ( String [ ] args ) { new TrieNode ( ) ; TrieNode root = getNode ( ) ; String [ ] dictionary = { " sam " , " sung " , " samsung " } ; int n = dictionary . Length ; for ( int i = 0 ; i < n ; i ++ ) { insert ( root , dictionary [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( dictionary [ i ] + " : ▁ STRNEWLINE " ) ; wordBreakAll ( root , dictionary [ i ] , dictionary [ i ] . Length , " " ) ; } } }