golang实现
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) func main() { var num, sum int sc := bufio.NewScanner(os.Stdin) for sc.Scan() { for _, str := range strings.Fields(sc.Text()) { num, _ = strconv.Atoi(str) sum += num } fmt.Println(sum) sum = 0 } }