(define s(read-line))
(define n(string-size s))
(define nn n)
(define i 0)
(define f 0)
(while #t
	(set! i 0)
	(set! f 0)
	(while(< i(- n 1))
		(unless(char=?(string-ref s i)(string-ref s(+ i 1)))
			(set! s(string-append(substring s 0 i)(substring s(+ i 2)n)))
			(set! f 1)
			(dec! n 2)
		)
		(inc! i)
	)
	(when(= f 0)(print(- nn n))(exit 0))
)