题解 | #去除字符串中重复的字符#
去除字符串中重复的字符
http://www.nowcoder.com/practice/ffaf8888a89a4bbab80767d18b401a26
#include<set>
// write your code here......
using namespace std;
int main() {
char str[100] = { 0 };
cin.getline(str, sizeof(str));
//使用c++中set实现字符串去重并排序
set<char> test;
int i,j,k;
for(i=0;str[i]!='\0';i+=1){
test.insert(str[i]);
}
//遍历set并输出所存储的字符
for(auto it=test.begin();it!=test.end();it++){
cout<< *it;
}
// write your code here......
return 0;
}