31 lines
371 B
Go
31 lines
371 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
var in string
|
|
var p string
|
|
var f string
|
|
var sum int
|
|
|
|
func main() {
|
|
fmt.Scanf("%s", &in)
|
|
for _, d := range strings.Split(in, "") {
|
|
if p == "" {
|
|
f = d
|
|
} else if p == d {
|
|
incr, _ := strconv.Atoi(p)
|
|
sum += incr
|
|
}
|
|
p = d
|
|
}
|
|
if f == p {
|
|
incr, _ := strconv.Atoi(p)
|
|
sum += incr
|
|
}
|
|
fmt.Println(sum)
|
|
}
|