結果

問題 No.342 一番ワロタww
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-19 09:29:49
言語 Go
(1.22.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 678 bytes
コンパイル時間 13,818 ms
コンパイル使用メモリ 212,864 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-11 13:28:07
合計ジャッジ時間 13,437 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 1 ms
4,372 KB
testcase_11 AC 2 ms
4,372 KB
testcase_12 AC 1 ms
4,368 KB
testcase_13 AC 1 ms
4,368 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 AC 2 ms
4,368 KB
testcase_16 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var s, t string
	var w int

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)
	sc.Scan()
	s = sc.Text()

	max := 1
	ans := make([]string, 0)
	for _, r := range []rune(s) {
		if string(r) == "w" {
			w++
		} else {
			if w != 0 {
				if max < w && t != "" {
					ans = []string{t}
					max = w
				} else if max == w && t != "" {
					ans = append(ans, t)
				}

				t = ""
				w = 0
			}
			t += string(r)
		}
	}

	if max < w && t != "" {
		ans = []string{t}
		max = w
	} else if max == w && t != "" {
		ans = append(ans, t)
	}

	// fmt.Println(ans)

	for _, str := range ans {
		fmt.Println(str)
	}
}
0