結果

問題 No.345 最小チワワ問題
ユーザー ic__e
提出日時 2022-12-10 15:26:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 351 bytes
コンパイル時間 412 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-14 23:41:54
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

# 最小チワワ問題
str = input()
count = 0
wCount = 0
ans = 0
j = ''
for s in str:
  if(s=='c' and wCount!=1):
    count=1
    j='w'
  elif(s=='w' and j=='w' and wCount!=2):
    count+=1
    wCount+=1
    if(wCount==2):
      ans=count
      count=0
      wCount=0
      j=0
  elif(j=='w'):
    count+=1
if(ans==0):
  print(-1)
else:
  print(ans)
0