// No.1168 Digit Sum Sequence package main import ( "fmt" "strconv" ) func main() { var n string fmt.Scan(&n) target := n for { sum := 0 for _, r := range target { x, _ := strconv.Atoi(string(r)) sum += x } target = strconv.Itoa(sum) if len(target) == 1 { break } } fmt.Println(target) }