백준 1152 알고리즘
https://www.acmicpc.net/problem/1152
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
w := bufio.NewWriter(os.Stdout)
defer w.Flush()
r := bufio.NewReaderSize(os.Stdin, 1000001)
line, _, _ := r.ReadLine()
text := strings.TrimSpace(string(line))
if text == "" {
fmt.Fprintf(w, "%d", 0)
} else {
splits := strings.Split(text, " ")
fmt.Fprintf(w, "%d", len(splits))
}
}