Update Main.java

StringIndexOutOfBoundsException replaced NullPointerException (i'm dumb)