Recursion removing string duplicates


please help with my logic…