#include <bits/stdc++.h> using namespace std; string str; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> str; n = str.length(); int ans = 0; for (int i = 0; i < n-1; i++) { for (int j = i + 1; j < n; j++) { if (str[i] > str[j]) { ans++; } else if (str[i] == str[j]) { int ii = i, jj = j; while (ii < jj) { ii++; jj--; if (str[ii] > str[jj]) { ans++; break; } else if (str[ii] < str[jj])//这个不能忘 { break; } } } else { continue; } } } cout << ans; }
0.0分
0 人评分