結果

問題 No.1534 おなかがいたい
ユーザー Escaity
提出日時 2021-06-20 19:54:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 291 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-22 22:34:32
合計ジャッジ時間 1,797 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

str = input()
p = 0
if "pain" in str:
    idx = str.find("pain")
    str = str[:idx]
    lenS = len(str)
    i = 0
    while i < lenS:

        if str[i : i + 3] == "pon":
            p += 1
            i += 3
        else:
            i += 1
if p <= 1:
    print(-1)
else:
    print(p - 1)
0