#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
int main(int argc, char* argv[])
{
std::vector<std::string> str = {"строка", "01строка", "09строка", "04строка", "03строка", "01строка",
"09строка", "05строка", "03строка", "строка", "01строка", "06строка",
"03строка", "06строка", "09строка", "строка", "01строка", "05строка",
"строка", "04строка", "строка", "09строка"};
// служебная "карта"
std::map<std::string, uint64_t> map;
// выходной массив
std::vector<std::string> out;
// собираем выходной массив
for(auto &&i:str) {
map[i] = (map.count(i) > 0) ? map[i] + 1 : 1;
std::ostringstream oss;
oss << '_' << std::setfill('0') << std::setw(3) << map[i];
out.push_back(i + oss.str());
}
// печать выходнго массива
for(auto &&i:out) {
std::cout << i << std::endl;
}
return 0;
}