extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* input;
unsigned counter;
void copy(size_t size, char *src, char *dest)
{
for (size_t i = 0; i < size; ++i)
dest[i] = src[i];
}
void readInput()
{
size_t size = 8, used = 0;
input = malloc(size);
goto read;
reserve:;
size *= 2;
char* new_input = malloc(size);
copy(used, input, new_input);
free(input);
input = new_input;
read:;
char c = fgetc(stdin);
if (c == '\n' || c == EOF)
goto end;
input[used++] = c;
if (used == size)
goto reserve;
goto read;
end:;
input[used] = '\0';
}
void getResults()
{
size_t size = strlen(input);
for (size_t i = 0; i < size; ++i)
for (size_t j = 0; j < size - i; ++j)
//printf("%c == %c", input[j], input[j + i]);
if (input[j] == input[j + i])
++counter;
}
int main()
{
readInput();
getResults();
printf("%d\n", counter);
}
}