That exception means that you are trying to acces an element of an array which doesnt exist. Say you've got an array which exists out of 5 elements(which is the max boundary as well), and you try to get information about a 6th one, then it will give that error, since it's out of its boundaries.
Also as in what you are doing wrong,
edit: didnt read your code well, let me read it again, sorry!
Try to print out s1. Also you are splitting s1 with s1. Something is not correct here!
you want it to split on a space (" ")