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

相关推荐

09-29 16:59
已编辑
门头沟学院 Java
牛客96609213...:疯狂背刺,之前还明确设置截止日期,还有笔试,现在一帮人卡在复筛,他反而一边开启扩招,还给扩招的免笔试,真服了,你好歹先把复筛中的给处理了再说
投递大疆等公司10个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务