import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(string s) {
    int ans = 0;
    for (int i = 0; i < s.length - 1; i++) {
        int cnt = 0;
        foreach (c; 'a'..'z') {
            if (s[0..i+1].canFind(c) && s[i+1..$].canFind(c)) {
                cnt++;
            }
        }
        ans = max(ans, cnt);
    }
    return ans;
}
void main() {
    readint;
    auto s = readln.chomp;
    writeln(calc(s));
}