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 solve_reqfast(string s)
        {
            int i = 1;
            string tren = "" + s[0];
            string prosli = "";
            int zb = 0;
            return solvereqfast(s, i, tren, prosli, new Dictionary<string, int>());
        }
        static int solvereqfast(string s, int i, string tren, string prosli, Dictionary<string, int> lookup)
        {
            if (i == s.Length)
            {
                return 0;
            }
            tren += s[i];
            string key = i + "|" + tren + "|" + prosli;
            if (!lookup.ContainsKey(key))
            {
                if (i == s.Length - 2)
                {
                    int prvi = 0;
                    int drugi = 0;
                    if (prosli.Length - tren.Length >= 0)
                    {
                        if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                        {
                            prvi = 1;
                        }
                    }
                    tren += s[i + 1];
                    if (prosli.Length - tren.Length >= 0)
                    {
                        if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                        {
                            drugi = 1;
                        }
                    }
                    return lookup[key] = prvi + drugi + solvereqfast(s, i + 2, tren, prosli, lookup);
                }
                else
                {
                    if (prosli.Length - tren.Length >= 0)
                    {
                        if (prosli[prosli.Length - tren.Length] == tren[tren.Length - 1])
                        {
                            if (tren.Length > 1)
                            {
                                return lookup[key] = 1 + Math.Max(solvereqfast(s, i + 1, tren, prosli, lookup), solvereqfast(s, i + 1, "", tren, lookup));
                            }
                            else
                            {
                                return lookup[key] = 1 + solvereqfast(s, i + 1, tren, prosli, lookup);
                            }
                        }
                    }
                    if (tren.Length > 1)
                    {
                        return lookup[key] = Math.Max(solvereqfast(s, i + 1, tren, prosli, lookup), solvereqfast(s, i + 1, "", tren, lookup));
                    }
                    else
                    {
                        return lookup[key] = solvereqfast(s, i + 1, tren, prosli, lookup);
                    }
                }
            }
            return lookup[key];
        }
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Console.WriteLine(solve_reqfast(s));
        }
    }
}