/+ dub.sdl:
    name "E"
    dependency "dcomp" version=">=0.3.2"
    lflags "-stack_size" "100000000"
+/
 
import std.algorithm, std.conv, std.range, std.stdio;
import std.string;

// import dcomp.scanner;
// import dcomp.ascii;
// import dcomp.string;

int main(string[] argv) {
    auto sc = new Scanner();
    ASCIIString s;
    sc.read(s);
    int n = s.length.to!int;
    auto lcp = sais(s).lcp;
    sort(lcp);
    int ma = 0;
    int sm = 0;
    int r = n;
    foreach_reverse (i; 1..n+1) {
        sm++;
        while (r > 0 && lcp[r-1] == i) {
            r--;
            sm--;
        }
        ma = max(ma, sm);
    }
    writeln(ma);
    return 0;
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

class Scanner {
    import std.stdio : File, stdin;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    File f;
    this(File f = stdin) {
        this.f = f;
    }
    string[] buf;
    private bool succ() {
        while (!buf.length) {
            if (f.eof) return false;
            buf = f.readln.split;
        }
        return true;
    }
    private bool readSingle(T)(ref T x) {
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                //string or char[10] etc
                x = buf.front;
                buf.popFront;
            } else {
                static if (isStaticArray!T) {
                    //static
                    assert(buf.length == T.length);
                }
                x = buf.map!(to!E).array;
                buf.length = 0;                
            }
        } else {
            x = buf.front.to!T;
            buf.popFront;            
        }
        return true;
    }
    int read(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
}

unittest {
    import std.path : buildPath;
    import std.file : tempDir;
    import std.algorithm : equal;
    import std.stdio : File;
    string fileName = buildPath(tempDir, "kyuridenanmaida.txt");
    auto fout = File(fileName, "w");
    fout.writeln("1 2 3");
    fout.writeln("ab cde");
    fout.writeln("1.0 1.0 2.0");
    fout.close;
    Scanner sc = new Scanner(File(fileName, "r"));
    int a;
    int[2] b;
    char[2] c;
    string d;
    double e;
    double[] f;
    sc.read(a, b, c, d, e, f);
    assert(a == 1);
    assert(equal(b[], [2, 3]));
    assert(equal(c[], "ab"));
    assert(equal(d, "cde"));
    assert(e == 1.0);
    assert(equal(f, [1.0, 2.0]));
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/string.d */
// module dcomp.string;

struct SA(T) {
    T[] s;
    int[] sa, rsa, lcp;
    this(in T[] s) {
        size_t n = s.length;
        this.s = s.dup;
        sa = new int[](n+1);
        rsa = new int[](n+1);
        lcp = new int[](n);
    }
}

SA!T sais(T)(in T[] _s, int B = 200) {
    import std.conv, std.algorithm, std.range;
    int n = _s.length.to!int;
    auto saInfo = SA!T(_s);
    if (n == 0) return saInfo;
    with (saInfo) {
        auto s = _s.map!"a+1".array ~ T(0); B++; // add 0 to last
        // ls
        bool[] ls = new bool[](n+1);
        ls[n] = true;
        foreach_reverse (i; 0..n) {
            ls[i] = (s[i] == s[i+1]) ? ls[i+1] : (s[i] < s[i+1]);
        }
        // sum(l[0], s[0], l[1], s[1], ...)
        int[] sumL = new int[](B+1), sumS = new int[](B+1);        
        s.each!((i, c) => !ls[i] ? sumS[c]++ : sumL[c+1]++);
        foreach (i; 0..B) {
            sumL[i+1] += sumS[i];
            sumS[i+1] += sumL[i+1];
        }

        void induce(in int[] lms) {
            auto buf0 = sumS.dup;
            sa[] = -1;
            foreach (d; lms) {
                sa[buf0[s[d]]++] = d;
            }
            auto buf1 = sumL.dup;
            foreach (v; sa) {
                if (v >= 1 && !ls[v-1]) {
                    sa[buf1[s[v-1]]++] = v-1;
                }
            }
            auto buf2 = sumL.dup;
            foreach_reverse (v; sa) {
                if (v >= 1 && ls[v-1]) {
                    sa[--buf2[s[v-1]+1]] = v-1;
                }
            }
        }
        
        int[] lms = iota(1, n+1).filter!(i => !ls[i-1] && ls[i]).array;
        int[] lmsMap = new int[](n+1);
        lmsMap[] = -1; lms.each!((i, v) => lmsMap[v] = i.to!int);

        induce(lms);
        
        if (lms.length >= 2) {
            int m = lms.length.to!int - 1;
            // sort lms
            auto lms2 = sa.filter!(v => lmsMap[v] != -1).array;
            int recN = 1;
            int[] recS = new int[](m);
            recS[lmsMap[lms2[1]]] = 1;
            foreach (i; 2..m+1) {
                int l = lms2[i-1], r = lms2[i];
                int nl = lms[lmsMap[l]+1], nr = lms[lmsMap[r]+1];
                if (cmp(s[l..nl+1], s[r..nr+1])) recN++;
                recS[lmsMap[lms2[i]]] = recN;
            }
            //re induce
            induce(lms.indexed(sais!int(recS, recN).sa).array);
        }

        //rsa
        sa.each!((i, v) => rsa[v] = i.to!int);
        //lcp
        int h = 0;
        foreach (i; 0..n) {
            int j = sa[rsa[i]-1];
            if (h > 0) h--;
            for (; j+h < n && i+h < n; h++) {
                if (s[j+h] != s[i+h]) break;
            }
            lcp[rsa[i]-1] = h;
        }
    }
    return saInfo;
}

unittest {
//     import dcomp.ascii;
    import std.algorithm, std.conv, std.stdio;
    import std.random;
    import std.typecons;
    import std.datetime;

    SA!T naive(T)(in T[] s) {
        int n = s.length.to!int;
        auto res = SA!T(s);
        res.s = s.dup;
        alias P = Tuple!(string, int);
        P[] buf = new P[](n+1);
        foreach (i; 0..n+1) {
            buf[i] = P(s[i..$].idup, i);
        }
        sort(buf);
        foreach (i, v; buf) {
            res.sa[i] = v[1];
        }
        foreach (i; 0..n+1) {
            res.rsa[res.sa[i]] = i;
        }
        foreach (i; 0..n) {
            res.lcp[i] = commonPrefix(buf[i][0], buf[i+1][0]).length.to!int;
        }
        return res;
    }

    writeln("SAIS Random100000");
    void f() {
        int n = uniform(1, 100);
        ASCIIString s;
        foreach (j; 0..n) {
            s ~= uniform('a', 'z');
        }
        auto l = naive(s);
        auto r = sais(s);
        assert(equal(l.s, r.s));
        assert(equal(l.sa, r.sa));
        assert(equal(l.rsa, r.rsa));
        assert(equal(l.lcp, r.lcp));
    }
    auto ti = benchmark!f(10000);
    writeln(ti[0].msecs, "ms");
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/ascii.d */
// module dcomp.ascii;

struct ASCIIString {
    string s;
    alias s this;
    this(string s) {
        this.s = s;
    }
    ref immutable(char) front() const {
        return s[0];
    }
    void popFront() {
        s = s[1..$];
    }
}

ASCIIString ascii(string s) {
    return ASCIIString(s);
}

unittest {
    import std.algorithm;
    import std.range.primitives;
    auto s = "タネなし手品";
    auto asc = s.ascii;
    assert(s.front == 'タ');
    assert(asc.front == "タ"[0]);
    assert(asc.map!(c => 1).sum == s.length);
}


Measured memory_bytes: 6040