Can anyone please explain how to overcome NZEC error in this code.
import java.util.*;
public class Main
{
public static void main(String args[])
{
String h;
int p;
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int i;
for(i=0;i<t;i++)
{
int ans=0;
int n=sc.nextInt();
int y=n*n;
String s=sc.next();
char x=sc.next().charAt(0);
String arr[]=new String[y];
int j,k,z=0;;
for(j=0;j<n;j++)
{
String a="";
for(k=j;k<n;k++)
{
a+=arr[k];
if(z<=n*n)
{
arr[z]=a;
z++;
}
}
}
for(j=0;j<y;j++)
{
h=arr[j];
p=h.length();
for(k=0;k<p;k++)
{
char r=h.charAt(k);
if(x==r)
{
ans++;
}
}
}
System.out.println(ans);
}
}
} |
|
| asked by Bitthal Maheshwari (bitthal04) 7 years ago | |
3 | |
Other Questions on This Topic
Chhod aaye the kinara kabhi apni talash mein, Par dil ki gehrayi se ek aisi aawaz aayi, Ki lautna pada hamein isi mod ki talash mein. |
|
| asked by Nisarg Bhavsar (nisarg71) 72 days ago | |
2 | |
Bengali grammar icse question paper can I get? |
|
| asked by Debosmita Malik (debosmitamalik) 126 days ago | |
1 | |
I wish to download question papers for ICSE prelims and I cannot do that. Can you provide the details of the Customer support for Respaper to get in touch with regarding the issue mentioned above. |
|
| asked by S.Hemalata Rajaram (hema1877) 229 days ago | |
1 | |

