0
Why doesn't it work?
Please look at this code. https://code.sololearn.com/c76PwSGvP2LX/?ref=app
1 Answer
+ 7
issue with line 11:
nodupl_1 != nodupl_2
When comparing strings, you should use the equals() method for comparison. So in your case it should be !nodupl_1.equals(nodupl_2).
However, there is still an issue with your logic of removing duplicate letters. You are only comparing sequentially. Your code won't work if the duplicate letter is not found one after the other. (e.g. "aartya" = based on your logic the result will be "artya" although answer should be "arty")