結果

問題 No.1534 おなかがいたい
ユーザー brthyyjpbrthyyjp
提出日時 2021-06-08 22:02:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 76,704 KB
最終ジャッジ日時 2023-08-18 02:50:28
合計ジャッジ時間 3,427 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,140 KB
testcase_01 AC 69 ms
71,176 KB
testcase_02 AC 70 ms
71,420 KB
testcase_03 AC 68 ms
71,580 KB
testcase_04 AC 73 ms
71,184 KB
testcase_05 AC 68 ms
71,472 KB
testcase_06 AC 69 ms
71,092 KB
testcase_07 AC 70 ms
71,092 KB
testcase_08 AC 69 ms
71,336 KB
testcase_09 AC 70 ms
71,480 KB
testcase_10 AC 69 ms
71,224 KB
testcase_11 AC 70 ms
71,368 KB
testcase_12 AC 83 ms
76,520 KB
testcase_13 AC 74 ms
76,048 KB
testcase_14 AC 75 ms
76,204 KB
testcase_15 AC 70 ms
71,620 KB
testcase_16 AC 77 ms
76,704 KB
testcase_17 AC 80 ms
76,480 KB
testcase_18 AC 79 ms
76,504 KB
testcase_19 AC 70 ms
71,444 KB
testcase_20 AC 76 ms
76,396 KB
testcase_21 AC 73 ms
71,260 KB
testcase_22 AC 70 ms
71,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = str(input())
n = len(s)
if n < 4:
    print(-1)
    exit()

for i in range(n-3):
    if s[i:i+4] == 'pain':
        p = i
        break
else:
    print(-1)
    exit()

t = s[0:p]
ans = t.count('pon')
if ans <= 1:
    print(-1)
else:
    print(ans-1)
0