It is impossible to assign a variable of type const char to the variable st .
Tell me how you can solve this problem.
char s; vector<string> str; map<char, string> encode; while (cin >> s) { encode[s]; } for (const auto &i : encode) { cout << i.first << " " << i.second << endl; } for (auto &i : encode) { string st = i.first; str.push_back(st); }