#include <bits/stdc++.h>
int main(void) {
  int i, j, k, m, n, max_length, length;
  char string[101];
  for (n = 0, scanf("%s", string); string[n]; n++)
    ;
  for (m = 1, max_length = 0; m < n; m++) {
    for (i = m - 1; i >= 0; i--) {
      for (j = i, k = m, length = 0; k && string[j] == string[k];
           j--, k--, length++)
        ;
      if (max_length < length) {
        max_length = length;
      }
    }
  }
  printf("%d", max_length);
  return 0;
}
