Can any one explain me why this code is giving run-time error
import java.util.Scanner;
class Code
{
public static void main(String arg[])
{
Scanner in=new Scanner(System.in);
int total=0,input=in.nextInt();
int arr[]=new int[26];
String s;
char arr2[];
while(input!=0)
{
for(int j=0;j<26;j++)
{
System.out.print(j+1+" ");
arr[j]=-1;
}
System.out.println();
s=in.next();
arr2=s.toCharArray();
for(int j=0;j<arr2.length;j++)
arr[Integer.valueOf(arr2[j])-97]=Integer.valueOf(arr2[j]);
for(int j=0;j<26;j++)
{
if(arr[j]==-1)
total=total+(j+1);
}
System.out.println("\n"+total+"\n");
input--;
total=0;
}
}
}