#include using namespace std; int main(){ string s; cin >> s; int l = s.size(); cout << (l-1)*(l-2)/2 << endl; }