結果
| 問題 | 
                            No.1534 おなかがいたい
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-02-23 21:06:55 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 54 ms / 2,000 ms | 
| コード長 | 246 bytes | 
| コンパイル時間 | 178 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-09-29 05:17:22 | 
| 合計ジャッジ時間 | 1,944 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
s = input()
s2 = s.replace("pain", "Y")
s3 = s2.replace("pon", "X")
# print(s3)
res = -1
ok = False
for c in s3:
    if c == "Y":
        ok = True
        break
    if c == "X":
        res += 1
if res == 0 or not ok:
    res = -1
print(res)