import java.io.*;
import java.util.*;
class Main
{
public static void main(String args[])throws IOException
{
InputReader reader = new InputReader(System.in);
PrintWriter ob=new PrintWriter(System.out);
int tt=reader.readInt();
while(tt-->0)
{
char x[]=reader.readString().toCharArray();
char y[]=reader.readString().toCharArray();
int l=x.length;
int m=y.length,i,j,q=101,d=256;
long p=0,t=0,h=1,count=0;
String ans="";
for(j=0;j<m-1;j++)
h=(h*d)%q;
for(j=0;j<m;j++)
{
p=(d*p + x[j])%q;
t=(d*t + y[j])%q;
}
for(i=0;i<=l-m;i++)
{
if(p==t)
{
for (j = 0; j < m; j++)
{
if (x[i+j]!=y[j])
break;
}
if (j == m)
{
count+=1;
ans=ans+(i+1)+" ";
}
}
if ( i < l-m )
{
t = (d*(t - (x[i]*h)) + x[i+m])%q;
if(t < 0)
t = (t + q);
}
}
if(count==0)
ob.println("Not Found");
else
{
ob.println(count);
ob.println(ans);
}
ob.println();
}
ob.close();
}
static final class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader(InputStream stream) {
this.stream = stream;
}
private int read() throws IOException {
if (curChar >= numChars) {
curChar = 0;
numChars = stream.read(buf);
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public final int readInt() throws IOException {
return (int)readLong();
}
public final long readLong() throws IOException {
int c = read();
while (isSpaceChar(c)) {
c = read();
if (c == -1) throw new IOException();
}
boolean negative = false;
if (c == '-') {
negative = true;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return negative ? -res : res;
}
public final int[] readIntArray(int size) throws IOException {
int[] array = new int[size];
for (int i=0; i<size; i++) {
array[i] = readInt();
}
return array;
}
public final long[] readLongArray(int size) throws IOException {
long[] array = new long[size];
for (int i=0; i<size; i++) {
array[i] = readLong();
}
return array;
}
public final String readString() throws IOException {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.append((char)c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
private boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
}
spoj.com/problems/NAJPF/
I am getting NZEC error in JAVA for this question
Can anyone just tell me whether if need to input a blank line after every test case or print a blank line after every test case
and this is the reason for which i am getting Nzec or i am repeatedly doing some mistake for which i am getting NZEC?? 