题目链接:https://www.lanqiao.cn/problems/598/learning/
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
string str = "jonmlkihgfedcba";
int cnt = 0;
for (int i = 0; i < str.size(); i++) {
for (int j = i + 1; j < str.size(); j++) {
if (str[i] > str[j]) {
swap(str[i], str[j]);
cnt++;
}
}
}
cout << cnt;
return 0;
}