{ "question_id": 978676, "question_title": "计算字符串逆序数", "question_content": "例如:字符串中的内容为:a1Ab1D2,1\n#include \nusing namespace std;\n\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}\n\nint main()\n{\n\tstring s = \"a1Ab1D2\";\n\tint n = solve(s);\n\tcout << n << endl;\n\treturn 0;\n}\n```\n\n# 问题解决请点下采纳", "tag_name": "c++", "cpp": "#include \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}", "topic_link": "https://bbs.csdn.net/topics/600469851", "status": 1, "keywords": "B树,算法高阶,高级数据结构,B树上的基本操作", "license": "csdn.net", "notebook": { "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/66.ipynb?type=file" }, "notebook_enable": 1, "author": "tanglei25" }