public class Szablon {

static int max_len = 500000;

static int []pref_suf = new int[max_len+1];

static char []sl = new char[max_len];

static int []zakres = new int[max_len+1];

static int []szablony = new int[max_len+1];

static int n;

public static void main(String[] args){

String slowo = "";

StreamTokenizer strTok = new StreamTokenizer(

new BufferedReader(

new InputStreamReader(System.in)

)

);

try {

strTok.nextToken();

slowo = strTok.sval;

} catch (IOException e) {

System.err.println("Input Stream ERROR");

}

for(int i = 0; i < slowo.length(); i++){

sl[i] = slowo.charAt(i);

}

n = slowo.length();

licz_pref_suf(sl);

wyznacz_szablon();

System.out.println(szablony[n]);

}

static void licz_pref_suf(char []sl){

char []slowo = new char[sl.length+1];

slowo[0] = 'a';

for(int i = 0; i < sl.length; i ++){

slowo[i+1] = sl[i];

}

int k = 0;

pref_suf[0] = pref_suf[1] = 0;

for(int q = 2; q <= n; q++){

while(k > 0 && slowo[k + 1] != slowo[q]){

k = pref_suf[k];

}

if(slowo[k + 1] == slowo[q]){

k++;

}

pref_suf[q] = k;

}

}

static void wyznacz_szablon(){

for(int i = 1; i <= n; i++){

szablony[i] = zakres[i] = i;

}

for(int i = 2; i <= n; i++){

int b = pref_suf[i];

if(b > 0){

int q = szablony[b];

if(zakres[q] >= i - q){

szablony[i] = q;

zakres[q] = i;

}

}

}

}

}