Write a function that inverts a dictionary (swaps keys and values).
Input: Key-value pairs, one per line
Output: The inverted dictionary with values as keys and keys as values
Example:
- Input:
{"a": 1, "b": 2} - Output:
{1: "a", 2: "b"}
Iterate through the original dictionary and build a new one with swapped positions. Consider: what if two keys have the same value?