I need to do a function that returns the Length of a part of the string that is both suffix and prefix. So: Given the string: abbabba, the answer would be 4, because that would be it:
Prefix:
a ab abb abba abbab abbabb
Suffix:
a ba bba abba babba bbabba
So abba is both a prefix and a suffix. How do I do this?
I started this way and I can not and I only have 10 more minutes.
public int teste(string nome)
{
string[] pre = new string[nome.Length];
string[] suf = new string[nome.Length];
for (int i = 0; i < nome.Length - 1; i++)
{
pre = nome[i].ToString();// Erro aqui
}
}