Fixed a bug in the 01.cpp
This commit is contained in:
@ -26,7 +26,7 @@ int main() {
|
|||||||
size_t index = current_str.find(item.second);
|
size_t index = current_str.find(item.second);
|
||||||
|
|
||||||
while(index != std::string::npos){
|
while(index != std::string::npos){
|
||||||
current_str.replace(index, item.second.length(), item.first);
|
current_str.replace(index, item.second.length() - 1, item.first);
|
||||||
index = current_str.find(item.second);
|
index = current_str.find(item.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user