#C2721. Filter Words by Frequency

    ID: 46069 Type: Default 1000ms 256MiB

Filter Words by Frequency

Filter Words by Frequency

You are given a dictionary of words along with their frequency counts. Your task is to filter this dictionary and keep only those words whose frequency falls within a given inclusive range \( [min\_freq, max\_freq] \).

Input Format: The input is read from standard input. The first line contains an integer \( n \) representing the number of entries in the dictionary. The following \( n \) lines each contain a word and its frequency (an integer), separated by a space. The last line contains two integers: \( min\_freq \) and \( max\_freq \), which represent the lower and upper bounds of the frequency range respectively.

Output Format: Output the filtered dictionary in the following format: if there is at least one word satisfying the condition, print the dictionary as a string in Python dictionary literal format (i.e. {'word1': frequency1, 'word2': frequency2, ...}). If no words satisfy the condition, output an empty dictionary {}.

You must preserve the order of words as they appear in the input.

inputFormat

The first line contains an integer \( n \) (\( n \ge 0 \)).\ The next \( n \) lines each contain a word (a string without spaces) and an integer frequency, separated by a space.\ The last line contains two integers \( min\_freq \) and \( max\_freq \) separated by a space.

outputFormat

Print the filtered dictionary in a Python dictionary literal format. If no words match, print {}.

## sample
5
apple 4
banana 2
orange 1
grape 5
mango 3
2 4
{'apple': 4, 'banana': 2, 'mango': 3}