Submission #2695081


Source Code Expand

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

t = int(arr_data[0][0])

for i in range(1, 1 + t):
    
    s = arr_data[i][0]
    
    cnt = 0
    posi = 0
    chkflg = True
    while chkflg:
        
        cnt_t=s.find("tokyo",posi)
        cnt_k=s.find("kyoto",posi)
        
        if cnt_t>=0 and cnt_k>=0:
            
            posi=min(cnt_t,cnt_k)+5
            
            cnt += 1
           
        elif cnt_t>=0 and cnt_k==-1:
        
            posi=cnt_t+5
             
            cnt += 1
        
        elif cnt_t==-1 and cnt_k>=0:
        
            posi=cnt_k + 5
            
            cnt += 1    

        else:
        
            chkflg = False
            
    else:
        print(cnt)
            
            
            

Submission Info

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