結果

問題 No.345 最小チワワ問題
ユーザー Liny52551272Liny52551272
提出日時 2019-11-15 14:09:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-24 08:45:34
合計ジャッジ時間 2,221 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()

lst = []

for i in range(len(S)):
  if S[i] == 'c':
    tmp = S.find('w', S.find('w', i + 1) + 1) - i + 1
    if tmp > 0:
      lst.append(tmp)

lst = sorted(lst)

#print(lst)
if len(lst) == 0:
  print('-1')
else:
  print(lst[0])
0