How to add dictionary keys with defined values to a list

I am trying to add dictionary keys with player-defined values into a list, for example if playertypes 1 into input field, the programm will add into the list all keys with value 1, but i can’t figure out how

Get the input in the code and use its .text value. With that value you can now get elements out of a dictionary like:

Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
InputField input = FindObjectOfType<InputField>();
input.text = "foo";
GameObject elementFromDictionary = dictionary[input.text];

If you want to populate a dictionary by player defined key and value then get the values and add it like this:

Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();

string key = "foo"; // Get this from whatever the player enters
GameObject foo = new GameObject(); // This is the userdefined value

dictionary.Add(key, foo); // pass the key and the stuff you want to have in the dictionary