import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

int findLongest(const(char)[] s) {
	int longest = -1;
	if(s.length <= 1) {
		return longest;
	}

	foreach(int i; 0 .. (cast(int) s.length) - 1) {
		for(int offset = 0;
				(0 <= (i - offset) && (i + 1 + offset) < s.length)
				&& (s[i - offset] != s[i + 1 + offset]);
				++offset) {
			longest = max(offset, longest);
		}
	}
	return longest;
	
}

void main() {
	auto s = readln();
	size_t count = 0;
	for(;;count += 2) {
		auto i = findLongest(s);
		if(i < 0) {
			break;
		}
		if(i + 2 < s.length) {
			s = s[0 .. i] ~ s[i + 2 .. $];
		} else {
			s = s[0 .. i];
		}
	}
	writefln("%s", count);
}
