[Solved] Weird Behavior while inserting a character into string in C++
I don’t know what you’re trying to accomplish but your code has a few logical bugs. Perhaps you intended to do s1.substr(i, 4) instead of s1.substr(i, i+4). The second argument of substr is length. Even after doing this you might enter infinite loop because the length of the string is increasing by 1 every-time you … Read more