Piyush and magical park (one of the three test case is not giving right answer, can u help me out with this.)

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int k = sc.nextInt();
int s = sc.nextInt();
char arr[][] = new char[n][m];
for(int i = 0;i<n;i++){
for(int j = 0;j<m;j++){
arr[i][j] = sc.next().charAt(0);
}
}
outerloop:
for(int i = 0;i<n;i++){
for(int j = 0;j<m;j++){
if(j>0)
s = s-1;
if(arr[i][j] == '
’)
s = s+5;
else if(arr[i][j] == ‘.’)
s = s-2;
else if(arr[i][j] == ‘#’){
if(s>=k){
System.out.println(“Yes”);
System.out.println(s);
}
else{
System.out.println(“No”);
}
break outerloop;}
}
}
}
}

Hi @8006366388,
There are some errors …Conceptual as well as coding … Like comparison must be done when all the rows are traversed not when # is reached . And there are more errors … i have added comments in the code …Check them.