Piyush and the magical park how to sca

even though i think my code is right i think i am facing problem in how to scan my input.
Here’s my code:
Scanner scn= new Scanner(System.in);
int row=scn.nextInt();
int col=scn.nextInt();
int min=scn.nextInt();
int s=scn.nextInt();
for(int i=1;i<=row;i++) {
for(int j=1;j<=row;j++) {
char a=scn.nextLine().charAt(0);
scn.nextLine().charAt(0);
if(a==’*’) {s=s+5;}
else if(a==’.’) {s=s-2;}
else if(a==’#’) {break;}

		}
	}
	if(s>min) {System.out.println("yes" +"\n" + s);}
	else {System.out.println("No");}

@Akankshaq,
https://ide.codingblocks.com/s/195455 Here is code which will scan the input. The approach is to take string input of every row and then traverse individual chars.

Your code will give wrong answer so kindly correct the logic.

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.