0
If a word contains an odd number of characters,you must replace the middle letter of the word use this sumbol "*"
2 Answers
+ 2
string replace_middle(string s, char c){
if(s.length()%2){
s[s.length()/2] = c;
}
return s;
}
0
use size to get the number of letters if this number modulo 2 is 1 then set the Stringname[lettercount/2] to *