Submission #3715017


Source Code Expand

def main():
    T = int(input())
    targets = ["tokyo", "kyoto"]
    for _ in range(T):
        answer = 0
        s = input()
        while(s):
            pos = len(s)
            found = False
            for t in targets:
                index = s.find(t)
                if index == -1:
                    lastindex = len(s)
                else:
                    found = True
                    lastindex = index + len(t)
                pos = min(lastindex, pos)
            if found:
                answer += 1
            s = s[pos:]
        print(answer)


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task A - 東京都
User blcn
Language Python (3.4.3)
Score 100
Code Size 637 Byte
Status AC
Exec Time 19 ms
Memory 3060 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 19 ms 3060 KB
20_noised_tokyoto.txt AC 19 ms 3060 KB
99_teuchi.txt AC 19 ms 3060 KB