import java.util.;
public class PiyushPark {
public static void main(String args[])
{
Scanner sr = new Scanner(System.in);
int M,N,K,S;
M = sr.nextInt();
N = sr.nextInt();
K= sr.nextInt();
S = sr.nextInt();
char str[][] = new char[M][N];
// String str = sr.nextLine();
for(int i =0 ; i< M; i++)
{
for(int j =0 ; j < N; j++)
{
str[i][j] = sr.next().charAt(0);
}
}
boolean flag = true;
int energy = S;
for(int i =0 ; i< M && flag == true; i++)
{
for(int j =0 ; j < N && flag == true; j++)
{
if(str[i][j]==’#’)
{
if(energy >= K)
{
System.out.print(“Yes\n”+energy);
flag = false;
break;
}
else if( energy < K)
{
System.out.println(“No”);
flag = false;
break;
}
}
else if(str[i][j]==’.’)
{
energy = energy-3;
if(energy <=0)
{
System.out.println(“No”);
flag= false;
break;
}
}
else if(str[i][j]==’’)
{
energy = energy+5;
}
}
}
/*This prints the char array */
// for(int i =0 ; i< M; i++)
// {
// for(int j =0 ; j < l ; j++)
// {
// System.out.print(str[i][j]);
// }
// System.out.println();
// }
}
}
This code fails the third condition can you suggest what it could be .
and secondly we only get 13 at column 2 row 2 if we dont substract 1 when we encounter *