

I was able to turn the string into a char iterator, but I could not figure out how to change elements of said iterator (this can be seen at line 55).
You have a few options here, but the easiest is to collect into a Vec<char>, replace the character there, then do a String::from_iter(chars) to get it back as a string.
You can also manipulate the original chars iterator directly through takes, skips, and so on and collect it into a string, but that’s more complicated.
Also, “character” is such a complicated concept because unicode is not simple. If you can work directly with bytes though, you can convert the string to a Vec<u8> (which is the underlying type for String), manipulate that directly, then do String::from_utf8 (or the same method for str) to convert it back to a string.




I agree, this makes the most sense. I was under the assumption they wanted to keep it as a
String, but your suggestion is a better way to approach the problem if they’re able to do that.