#include #include #include #include #include #include #include using namespace std; string wordtolower(string s) { transform(begin(s), end(s), begin(s), ::tolower); return s; } int main() { ifstream file{"given_files/SUBSTITUTIONS.TXT"}; map dict; string search; string replace; while ( getline( getline( file, search, ':'), replace) ) { dict[ wordtolower(search) ] = wordtolower(replace); } map const& cdict{dict}; transform( istream_iterator{cin}, istream_iterator{}, ostream_iterator{cout, " "}, [&cdict](string s){ string l{wordtolower(s)}; if ( cdict.count(l) ) return cdict.at(l); else return s; }); cout << endl; return 0; }