题解 | 提取不重复的整数
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string s ;
cin>>s;
reverse(s.begin(), s.end());
for(int i=0;i<s.length();i++)
{
int j=i+1;
while(j<s.length()){
if(s[j]==s[i]){
s.erase(j,1);
}
j++;
}
}
cout << s << endl;
return 0;
}

查看7道真题和解析