結果

問題 No.1534 おなかがいたい
ユーザー vwxyz
提出日時 2022-09-06 17:17:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-21 18:16:41
合計ジャッジ時間 2,081 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
write=sys.stdout.write

S=readline().rstrip()
N=len(S)
for i in range(N-3):
    if S[i:i+4]=="pain":
        S=S[:i+4]
        cnt=S.count("pon")
        if cnt>=2:
            ans=cnt-1
        else:
            ans=-1
        break
else:
    ans=-1
print(ans)
0