edit
handles single instance of abc
handles single instance of aba
handles all cases recursively