String-remove duplicates

Can you point out the mistake in my code


passing only one test case