結果

問題 No.996 Phnom Penh
ユーザー titiatitia
提出日時 2020-04-08 03:52:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,672 KB
最終ジャッジ日時 2024-07-16 02:09:55
合計ジャッジ時間 9,688 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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

LEN=len(S)

L=[]
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
        L.append(s)

if L==[]:
    ANS=0
else:
    ANS=max(L)+sum(L)+1

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

if S==T:
    print(ANS)
    
else:    
    L=[]
    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
            L.append(s)

    if L==[]:
        ANS2=0
    else:
        ANS2=max(L)+sum(L)+2

    print(max(ANS,ANS2))
0