关键部分代码为
char aa[]="qwyugdtwqfdetgwsfcdtyz"; char dest[3]; set<char> a; //set<char>::iterator iter=aa; a.insert(aa,aa+strlen(aa)); for(set<char>::reverse_iterator iter=a.rbegin();iter!=a.rend();iter++) cout<<*iter<<" "; cout<<endl; set<char>::reverse_iterator iter=a.rbegin(); dest[0]=*(iter++); dest[1]=*(iter++); dest[2]=*(iter++); cout<<dest[0]<<" "<<dest[1]<<" "<<dest[2]<<endl;