If ( result == word ) then return If you don 't want to print last word
System . out . print ( " TABSYMBOL " + result + "NEW_LINE"); return ; } wordBreakAll ( root , word . substring ( i , n ) , n - i , result + prefix + " ▁ " ) ; } } }