#include <iostream>
#include <type_traits>
#include <vector>
#include <string>
#include <functional>
#include <map>
#include <algorithm>
#include <sstream>
#include <set>
#include <unordered_map>
#include <string>
int main()
{
std::map<int, std::string> searchMap={{1,"one"},{2,"two"}}; //map in which key is to be searched
std::map<int, std::string> outputMap;
int input =0;
if(std::cin >> input); //take input from user
{
//search the map for the input key
auto findInput = searchMap.find(input);
if(findInput!=searchMap.end())//check if the input was found inside the map
{
std::cout << "The map contains the key: " << input << " entered by user" << std::endl;
//add the key value pair to the outputmap
outputMap.insert({input,findInput->second}); //or just outputmap[input] = findInput->second
}
else
{
std::cout <<"The map does not contain the key: " << input << " entered by user" << std::endl;
}
}
//lets confirm that outputmap was filled with input
for(const auto&[key, value]:outputMap)
{
std::cout << key << "->" << value << std::endl;
}
}