結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-03-16 13:15:25 | 
| 言語 | Go  (1.23.4)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 365 bytes | 
| コンパイル時間 | 16,262 ms | 
| コンパイル使用メモリ | 222,420 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-01 22:27:27 | 
| 合計ジャッジ時間 | 15,283 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 12 WA * 17 | 
ソースコード
package main
import (
	"fmt"
	"regexp"
	"strings"
)
func main(){
	var s string
	fmt.Scan(&s)
	r := regexp.MustCompile(`c[^w]*w[^w]*w`)
	
	var ans int = -1
	for {
		index := strings.Index(s, "c")
		if index == -1 {
			break
		}
		s = s[index:]
		res := r.FindString(s)
		if ans < 0 || len(res) < ans {
			ans = len(res)
		}
		s = s[1:]
	}
	fmt.Println(ans)
}