Getting an runtime error while using java Scanner in code i am unable to find out the error

By NRaghavendra

import java.io.*;
import java.util.*;
public class milli{
public static void main(String[] args)
{
int t;
Scanner sc=new Scanner(System.in);
t=sc.nextInt();
for(int i=0;i<t;i++)
{
String al,be;
int yu,f,k=0;
yu=0;
al=sc.nextLine();
be=sc.nextLine();
for(int ff=0;ff<al.length();ff++)
{
if(al.charAt(ff)==be.charAt(ff))
{
yu++;
}
}
for(int j=0;j<=t;j++)
{
f=sc.nextInt();
if(j==yu)
{
k=f;
}
}
System.out.println(k);
}
}
}

the error is:
Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at milli.main(milli.java:8)

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273