結果
| 問題 | 
                            No.1534 おなかがいたい
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ohana
                         | 
                    
| 提出日時 | 2023-10-20 17:28:04 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 51 ms / 2,000 ms | 
| コード長 | 372 bytes | 
| コンパイル時間 | 185 ms | 
| コンパイル使用メモリ | 82,200 KB | 
| 実行使用メモリ | 61,596 KB | 
| 最終ジャッジ日時 | 2024-09-20 13:04:23 | 
| 合計ジャッジ時間 | 2,530 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
s = input()
s.replace("_", "")
s += "_____"
i = 0
cnt = 0
while i < len(s):
    if s[i : i + 3] == "pon":
        cnt += 1
        i += 3
    elif s[i : i + 4] == "pain":
        if cnt < 2:
            print(-1)
            exit()
        else:
            print(cnt - 1)
            exit()
    elif s[i] == "_":
        print(-1)
        exit()
    else:
        i += 1
            
            
            
        
            
ohana