Submission #1306096


Source Code Expand

import java.util.*;

public class Main {
    public static void main(String args[]) {
        FastScanner cin = new FastScanner();
        String s = cin.next();
        StringBuilder p = new StringBuilder(s);
        int cntP = 0;

        for (int i = 0, j = 0; i < s.length(); ++i) {
            if (p.charAt(i) == 'p')
                ++cntP;
        }

        System.out.println(s.length() / 2 - cntP);
    }

    static class FastScanner {
        StringTokenizer tokenizer;
        Scanner scanner;

        FastScanner() {
            tokenizer = null;
            scanner = new Scanner(System.in);
        }

        int nextInt() {
            while (tokenizer == null || !tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(scanner.nextLine());

            return Integer.parseInt(tokenizer.nextToken());
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens())
                tokenizer = new StringTokenizer(scanner.nextLine());

            return tokenizer.nextToken();
        }
    }
}

Submission Info

Submission Time
Task A - AtCoDeer and Paint Cans
User pnnb
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1117 Byte
Status WA
Exec Time 91 ms
Memory 21844 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
WA × 2
AC × 1
WA × 5
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt
Case Name Status Exec Time Memory
0_000.txt WA 91 ms 21332 KB
0_001.txt WA 90 ms 21844 KB
1_002.txt WA 90 ms 21844 KB
1_003.txt AC 91 ms 21588 KB
1_004.txt WA 88 ms 21844 KB
1_005.txt WA 88 ms 18772 KB