{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "97926ffce4134ed2a2317cfdd0378175", "keywords": "B树,算法高阶,高级数据结构,B树上的基本操作", "title": "计算字符串逆序数", "desc": [ { "content": "\n例如:字符串中的内容为:a1Ab1D2,1\n#include \nusing namespace std;\nint solve(string s)\n{\n\tif (s.length() == 0) return 0;\n\tint n = 0;\n\tfor (int i = 1; i < s.length(); i++)\n\t\tif (s.c_str()[i] < s.c_str()[i - 1]) n++;\n\treturn n;\n}\nint main()\n{\n\tstring s = \"a1Ab1D2\";\n\tint n = solve(s);\n\tcout << n << endl;\n\treturn 0;\n}", "language": "cpp" }, "node_id": "dailycode-9054271f126f49929fe1552a8017408a", "license": "csdn.net", "created_at": 1637894160, "topic_link": "https://bbs.csdn.net/topics/600469851" }