Submission #929457


Source Code Expand

Copy
public class Main {

	public static void main(String[] args) {
		Scanner sc =  new Scanner(System.in);
		char[] c = sc.next().toCharArray();
		int n = c.length;
		int score = 0;
		int p = 0;
		
		for(int i=0; i<n; i++){
			if(p>0){
				if(c[i] == 'g'){
					score++;
					p--;
				}else{
					p--;
				}
			}else{
				if(c[i] == 'g'){
					p++;
				}else{
					p++;
					score--;
				}
			}
		}
		System.out.println(score);
	}

}

Submission Info

Submission Time
Task D - AtCoDeer and Rock-Paper
User yukidaruma6
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 458 Byte
Status

Compile Error

./Main.java:4: error: cannot find symbol
		Scanner sc =  new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
./Main.java:4: error: cannot find symbol
		Scanner sc =  new Scanner(System.in);
		                  ^
  symbol:   class Scanner
  location: class Main
2 errors