CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Peli
Sender:TapaniS
Submission time:2020-11-08 08:45:46 +0200
Language:Java
Status:COMPILE ERROR

Compiler report

input/peli.java:22: error: cannot find symbol
			ind2 = a.indexOf("P");
			       ^
  symbol:   variable a
  location: class peli
1 error

Code

import java.util.*;
public class peli {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//int t = input.nextInt();
int t = Integer.parseInt(input.nextLine());
int ind1 = 0;
int ind2 = 0;
int ans = 0;
for (int i = 0; i < t; i++) {
String abc = input.nextLine();
ind1 = abc.indexOf("P");
abc = abc.replaceFirst("P",".");
ind2 = a.indexOf("P");
ans = ((ind2 - ind1) % 2) + 1;
System.out.println(ans);
}
input.close();
}
}