nit: I'd use a `for (size_t i = 0; i < input.size(); ++i)` loop instead, as that's much shorter and easier to read.