using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using System.Numerics;
//using System.Data;
//using System.Drawing;

namespace ConsoleApp3
{
    class Program
    {
        static int lastocceq(string s, int i1, int i2)
        {
            if (i2 >= s.Length)
            {
                int raz = i2 - s.Length + 1;
                i1 += raz;
                i2 = s.Length - 1;
            }
            while (i1 < i2)
            {
                if (s[i1] == s[i2])
                    return i2;
                i1++;
                i2--;
            }
            return 0;
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string prosli = "";
            string tren = "";
            tren += s[0];
            int i = 1;
            int score = 0;
            while(i<s.Length)
            { 
                int ind = lastocceq(s, i-tren.Length, tren.Length + i-1);
                if(ind!=0 && tren.Length>1)
                {
                    if(i==s.Length-1)
                    {
                        tren += s[i];
                        if (prosli.Length - tren.Length >= 0)
                            if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                                score++;
                        break;
                    }
                    prosli = tren;
                    tren = "";
                    while(i<=ind)
                    {
                        tren += s[i];
                        if (prosli.Length - tren.Length >= 0)
                            if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                                score++;
                        if (i != ind)
                            i++;
                        else break;
                    }
                }
                else
                {
                    tren += s[i];
                    if (prosli.Length - tren.Length >= 0)
                        if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                            score++;
                }
                i++;
            }
            Console.WriteLine(score);
        }
    }
}