using System;
public class Test
{
public static void Main()
{
String nome = "abbabba";
var i = 0; // começo
var j = nome.Length-1; // fim
var tamanho = 0;
var sufixoEprefixo = "";
while (i <= j) {
if (nome[i] == nome[j]) {
tamanho++;
sufixoEprefixo += nome[i];
} else {
break;
}
i++;
j--;
}
Console.WriteLine(tamanho);
Console.WriteLine(sufixoEprefixo);
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCVN0cmluZyBub21lID0gImFiYmFiYmEiOwoJCQoJCXZhciBpID0gMDsgLy8gY29tZcOnbwoJCXZhciBqID0gbm9tZS5MZW5ndGgtMTsgLy8gZmltCgkJdmFyIHRhbWFuaG8gPSAwOwoJCXZhciBzdWZpeG9FcHJlZml4byA9ICIiOwoJCQoJCXdoaWxlIChpIDw9IGopIHsKCQkJaWYgKG5vbWVbaV0gPT0gbm9tZVtqXSkgewoJCQkJdGFtYW5obysrOwoJCQkJc3VmaXhvRXByZWZpeG8gKz0gbm9tZVtpXTsKCQkJfSBlbHNlIHsKCQkJCWJyZWFrOwoJCQl9CgkJCWkrKzsKCQkJai0tOwoJCX0KCQlDb25zb2xlLldyaXRlTGluZSh0YW1hbmhvKTsKCQlDb25zb2xlLldyaXRlTGluZShzdWZpeG9FcHJlZml4byk7Cgl9Cn0=