The code doesn't have any comments describing the logic it is using.
Why do you think the code's logic will solve the problem?
For debugging I use println() statements that print out the values of variables as they are changed and used.
If you understand what the code is supposed to do, seeing what it actually does should show you where the problems are and help you find solutions to get it to work.
I can't help you with the IDEs interactive debugging.
For testing I'd start with a short String so there isn't too much debug output. Gradually change the String until the code fails and then work on why it failed and find a solution.