Jeżeli dobrze zrozumiałem polecenie to tak:
std::string conversion(std::string text) {
char firstLetter = text[0];
char changeLetter = '*';
std::string ans = "";
ans += changeLetter;
for (int i = 1; i < text.size(); ++i) {
if (text[i] == firstLetter) {
ans += "*";
}
else {
ans += text[i];
}
}
return ans;
}