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>
点赞

相关推荐

01-12 17:45
门头沟学院 Java
985废物一枚:就是问问你能不能接受北京的房租,hr也知道公司工资不高,大概率是要贴钱的
找实习记录
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务