#include <iostream>
using namespace std;
#define NSIZ 100100
#define MODE 256
char str[NSIZ];
int Next[NSIZ];
int num[NSIZ];
void getNext(char str[], int n)
{
int i = 0, j = -1;
Next[i] = -1;
while(i < n)
{
if (-1 == j || str[i] == str[j])
{
++i; ++j;
Next[i] = j;
}
else
{
j = Next[j];
}
}
}
int main()
{
int i = 0;
int res = 0;
while(scanf("%s", str) != EOF)
{
int n = strlen(str);
getNext(str, n);
memset(num, 0, sizeof(num));
res = 0;
for (i = 1;i <= n; ++i)
{
num[i] = (num[Next[i]] + 1) % MODE;
res = (res + num[i]) % MODE;
}
printf("%d\n", res);
}
return 0;
}