so i have this problem.
a word is written
then all characters of the alphabet that are not in the word,are written after it,in alphabetical order.
so lets say the word is
whatislove
the output would be
whatislovebcdfgjkmnpqruxyz
(i used whatislove cause its a sentence with no repeating letters,since thats my problem)
so i have that sorted,the thing is,no two letters can be repeating.
now,i have an idea on how to do this using the erase function
size_t returns the first place where an object was found,so just erase all other objects that are the same as the one found,after the first place it was found at.
problem is, erase function doesn't take size_t as a par,and i can't figure out what it even needs.I know it can take sting.begin() as a paramater,but other than that i am completely confused.
this is the code i have until now
(alphabetType_ is the number of letters in the alphabbet)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
for(int i = 0; i<alphabetType_;i++){
//tochar converts from int to char 0-a,1-b....
std::size_t foundAt=keyword.find(toChar(i));
int a= static_cast<int>(foundAt);
if(foundAt!=std::string::npos){
//this is where i think i can fit some code to remove letters in
}else{
keyword+=toChar(i);
}
|