結果
| 問題 |
No.1534 おなかがいたい
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:12:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 495 bytes |
| コンパイル時間 | 450 ms |
| コンパイル使用メモリ | 82,400 KB |
| 実行使用メモリ | 62,668 KB |
| 最終ジャッジ日時 | 2025-03-20 21:13:53 |
| 合計ジャッジ時間 | 2,089 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
s = input().strip()
# Find the first occurrence of 'pain'
pain_start = s.find('pain')
if pain_start == -1:
print(-1)
else:
# Extract the substring before the first 'pain'
substring = s[:pain_start]
count = 0
# Iterate through the substring to count 'pon's
for i in range(len(substring) - 2):
if substring[i] == 'p' and substring[i+1] == 'o' and substring[i+2] == 'n':
count += 1
if count < 2:
print(-1)
else:
print(count - 1)
lam6er