結果

問題 No.996 Phnom Penh
ユーザー titiatitia
提出日時 2020-04-08 03:43:01
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 713 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 8,904 KB
最終ジャッジ日時 2023-09-23 01:19:03
合計ジャッジ時間 9,203 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,784 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 16 ms
7,784 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 16 ms
7,824 KB
testcase_20 AC 15 ms
7,744 KB
testcase_21 AC 16 ms
7,888 KB
testcase_22 WA -
testcase_23 AC 16 ms
7,824 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
LEN=len(S)
S+="z"*100

LEN=len(S)

MAX=0
for i in range(LEN):
    if S[i:i+3]=="phn":
        s=0
        j=i+3
        while S[j:j+2]=="om":
            s+=1
            j+=2
        MAX=max(s,MAX)

if MAX==0:
    ANS=0
else:
    ANS=MAX*2+1

T=""
for s in S:
    if s=="h":
        continue
    if s=="e":
        T+="h"
    else:
        T+=s

if S==T:
    print(ANS)
    
else:    
    MAX=0
    for i in range(len(T)):
        if T[i:i+3]=="phn":
            s=0
            j=i+3
            
            while T[j:j+2]=="om":
                s+=1
                j+=2
                
            MAX=max(s,MAX)

    if MAX==0:
        print(max(ANS,1))
    else:
        print(max(ANS,MAX*2+2))
0