Submission #5284649
Source Code Expand
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int T = scanner.nextInt(); String[] s = new String[T]; for (int i = 0; i < T; i++) { s[i] = scanner.next(); } for (int i = 0; i < T; i++) { int ans = 0; for (int j = 0; j <= s[i].length() - 5;) { if (s[i].substring(j, j + 5).equals("tokyo")) { ans++; j += 5; } else if (s[i].substring(j, j + 5).equals("kyoto")) { ans++; j += 5; } else { j++; } } System.out.println(ans); } } }
Submission Info
Submission Time | |
---|---|
Task | A - 東京都 |
User | frog2002 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 816 Byte |
Status | AC |
Exec Time | 121 ms |
Memory | 21204 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
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 | 20816 KB |
20_noised_tokyoto.txt | AC | 121 ms | 21204 KB |
99_teuchi.txt | AC | 104 ms | 19924 KB |