well, 'A' i at position 65, whereas 'a' is at postion 97.
So if you run your programm with the Parameter NoOn, the following
happened at the line
word.charAt(i) returns 78, the position of 'N'. 78-97=-19 and that
causes the Exception, because negative array indices are not allowed.
So, you have to replace the 'a' with and 'A', further the curly brace
for the if-statement should go 2 lines below, that this works correctly. that's all.