(Feb-23-2017, 10:46 PM)Ofnuts Wrote: Well... of course, because the mission is to delete a character in front a |BS|. The specs are a bit vague about what should happen when there is no character in front of the BS. This behavior is coherent with not erasing characters from another |BS|.
I think that specs are quite vague. But if the task was to emulate the backspace on a keyboard, then even with an empty buffer the backspace is consumed (usually). And as its processed sequentially, there is never previous |BS|.
Your implementation of less_naive is exactly the improvement I mentioned before - find first |BS|, copy chunk of chars without last one, find next one and so on. For some reason (now I see that groundless one) I thought that it would need little more effort to keep right, and as naive was fast enough, I didnt bother to try it.