While you are on a state do not change ur state on encountering a specific character if u have already done so earlier.This check in addition to the usual permutation generation code gives the desired output.
Above code works only for lowercase characters.Bits of mask are used to remember previous visit. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.