結果

問題 No.1159 Sashiming String
ユーザー brthyyjp
提出日時 2021-04-29 17:42:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 1,408 ms
コンパイル使用メモリ 81,740 KB
実行使用メモリ 92,688 KB
最終ジャッジ日時 2024-07-16 02:54:34
合計ジャッジ時間 2,151 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

s = str(input())
n = len(s)
if n < 4:
    print(0)
    exit()
C = [0]*n
for i, c in enumerate(s):
    if c == 'S':
        C[i] += 1
from itertools import accumulate
C = [0]+C
C = list(accumulate(C))
ans = 0
for i in range(n-3+1):
    if s[i] == 'i' and s[i+1] == 'n' and s[i+2] == 'g':
        ans += C[i]
print(ans)
0