package main

import (
	"fmt"
	"strings"
)

func next_string(str string, ans int) int {
	var ans_end int
	var befor_num, next_pre_str, next_str, next_post_str string
	var flag bool
	str_slice := strings.Split(str, "")
	for i, num := range str_slice {
		if i == 0 {
			befor_num = num
		} else {
			if num != befor_num {
				for j := i + 1; j < len(str); j++ {
					next_post_str += str_slice[j]
				}
				next_str = next_pre_str + next_post_str
				fmt.Println(ans)
				ans_end = next_string(next_str, ans+2)
				flag = !flag
				break
			}
			befor_num = num
		}
		next_pre_str += num
	}
	if flag {
		return ans_end
	} else {
		return ans
	}
}

func main() {
	var s string
	var ans int
	fmt.Scan(&s)
	ans = next_string(s, ans)
	fmt.Println(ans)
}