#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ';
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << ' ';
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << ' ';
  pr(b, c, d);
}
template <class A>
void PR(A a, long long n) {
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (i) cout << ' ';
    cout << a[i];
  }
  cout << '\n';
}
long long check(long long n, long long m, long long x, long long y) {
  return x >= 0 && x < n && y >= 0 && y < m;
}
const long long MAX = 1000000007, MAXL = 1LL << 61, dx[4] = {-1, 0, 1, 0},
                dy[4] = {0, 1, 0, -1};
void Main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long d[26][n + 1];
  vector<long long> v[26];
  memset(d, 0, sizeof(d));
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    d[s[i] - 'a'][i + 1]++;
    v[s[i] - 'a'].push_back(i);
  }
  for (long long j = (long long)(0); j < (long long)(26); j++) {
    for (long long i = (long long)(0); i < (long long)(n); i++)
      d[j][i + 1] += d[j][i];
  }
  set<char> se;
  long long ans = 0;
  for (long long i = (long long)(0); i < (long long)(26); i++) {
    if (d[i][n] == 1) se.insert((char)(i + 'a'));
  }
  long long c[26], k = -1;
  memset(c, -1, sizeof(c));
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    if (se.count(s[i])) {
      long long cnt = 0;
      for (long long j = (long long)(0); j < (long long)(26); j++) {
        if (c[j] != -1 && c[j] < k) {
          cnt++;
          c[j] = -1;
        }
      }
      ans += cnt + 1;
      k = i;
      continue;
    }
    if (c[s[i] - 'a'] == -1)
      c[s[i] - 'a'] = i;
    else
      c[s[i] - 'a'] = -1;
  }
  for (long long i = (long long)(0); i < (long long)(26); i++)
    ans += c[i] != -1;
  pr(max(1LL, ans));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  Main();
  return 0;
}
