int main() { std::string str; std::vector<char> tempVec = {}; while(getline(cin, str)) { int length = str.size(); for(int j = 0; j < 26; j++) { for (int i = 0; i < length; i++) { if((str[i] - 'a' == j) || (str[i] -'A' == j)) { tempVec.push_back(str[i]); } } } for (int i = 0, k = 0; (i < length) && (k < tempVec.size()); i++) { if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) { str[i] = tempVec[k++]; } } cout << str << endl; } return 0; } /*#include <iostream> 这样不和楼主的一样吗?</iostream></char>
点赞

相关推荐

10-28 14:42
门头沟学院 Java
watermelon1124:因为嵌入式炸了
点赞 评论 收藏
分享
牛客网
牛客企业服务