Submission #3371163


Source Code Expand

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.nextLine();
        for (int i = 0; i < N; i++) {
            int ret = 0;
            String str = sc.nextLine();
            for (int j = 0; j <= str.length() - 5;) {
                if (str.substring(j, j + 5).equals("tokyo")) {
                    ret++;
                    j += 5;
                } else if (str.substring(j, j + 5).equals("kyoto")) {
                    ret++;
                    j += 5;
                } else {
                    j++;
                }
            }
            System.out.println(ret);
        }
    }
}

Submission Info

Submission Time
Task A - 東京都
User sykwer
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 744 Byte
Status AC
Exec Time 119 ms
Memory 23252 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt AC 119 ms 23124 KB
20_noised_tokyoto.txt AC 119 ms 22736 KB
99_teuchi.txt AC 117 ms 23252 KB