#include #include using namespace std; using namespace atcoder; using ll = long long; using ull = unsigned long long; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vs = vector; using vpi = vector>; using vpl = vector>; #define rep(i, s, n) for (int i = (s); i < (int)(n); ++i) #define repr(i, s, n) for (int i = (s); i >= (int)(n); --i) #define sz(x) ((int)(x).size()) template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} auto _ = []{ios::sync_with_stdio(false); cin.tie(nullptr); return 0;}(); const int INFI = 1 << 30; const ll INFL = 1LL << 62; int main() { string s; cin >> s; int n=sz(s); ll sm=0; rep (i, 0, n-2){ mapmp; rep (j, 0, 3){ mp[s[i+j]]++; } if(sz(mp)!=2)continue; sm++; } cout << sm << '\n'; return 0; }