#include <string>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cctype>

std::string optimize(std::string toBeProcessed, std::string toBeIgnored, char ch)
{
    std::transform(toBeProcessed.begin(), toBeProcessed.end(), toBeProcessed.begin(), ::toupper);
    std::transform(toBeIgnored.begin(), toBeIgnored.end(), toBeIgnored.begin(), ::toupper);
    std::string test;
    size_t start = 0;
    while (start < toBeProcessed.size())
    {
        size_t n = toBeProcessed.find_first_not_of(toBeIgnored, start);
        if ( n != std::string::npos)
        { 
            toBeProcessed[n] = ch;
            start = n+1;
        }
        else
            break;
    }
    return toBeProcessed;
}

int main()
{
    std::string out = optimize("abc123", "abc1", 'x');
    std::cout << out;
}