Piyush and Magical Park

2 testcases are passwed but one is giving wrong answer please help

package Challenges;

import java.util.Scanner;

public class Piyushandmagicalprank {
static Scanner scan=new Scanner(System.in);
public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

int rows=scan.nextInt();

int columns=scan.nextInt();
int k=scan.nextInt();
int s=scan.nextInt();

char [][] array=new char[rows][];

for(int row=0;row<array.length;row++)
{

array[row]=new char[columns];

for(int column=0;column<array[row].length;column++)
{

array[row][column]=scan.next().charAt(0);

}

}

if(rows<=100&&columns<=100&&k<=100&&s<=100)
{
addstrength(array,k,s);

}

}

public static void addstrength(char[][] array ,int k,int s)
{

for(int i=0;i<array.length;i++)
{
	
	for(int j=0;j<array[i].length;j++)
	{
		
		char ch=array[i][j];
		if(ch=='*')
		{
			s=s+5;
			if(j<array[i].length-1)
			{
			s=s-1;
			}
		}
		else if(ch=='.')
		{
			s=s-2;
			if(j<array[i].length-1)
			{
			s=s-1;
			}
		
		}
	
		else if(ch=='#')
		{
			
			break;
		}
	}

	


}

if(s>5)
{
	System.out.println("Yes");
	System.out.println(s);
}

else
{
	System.out.println("No");
}

}
}

hi @Pradeep there were few silly mistakes … I have marked those lines with comments and also mentioned the mistakes … and overall code and logic were correct !

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.