Because comments don't allow good code formatting:
At the beginning of your code, you get the String
contents as a char[]
and immediately lose it again by assigning a new char[]
of the same size to the variable.
char[] b = inputString.toCharArray();
b = new char[b.length];
so the loop after works on a default-initialized array, not on the string contents. You need two array references to do the copying.