#C101. Remove Outdated Programming Languages
Remove Outdated Programming Languages
Remove Outdated Programming Languages
You are given a list of problems, each containing a list of programming languages that are preferred for that problem. You are also given a list of outdated languages. For each problem, your task is to remove any language that appears in the outdated list. If none of the languages remain after removal, you should output None
for that problem. Otherwise, output the remaining languages joined by a single space.
Note: The input is provided via stdin
and the output should be printed to stdout
.
Formally, if a problem has languages \(L_1, L_2, \ldots, L_k\), and the set of outdated languages is \(O\), then the final list for that problem is \(\{L_i : L_i \notin O\}\). If the list is empty, print None
.
inputFormat
The first line contains two integers \(m\) and \(o\) separated by a space, where \(m\) is the number of problems, and \(o\) is the number of outdated languages.
The next \(m\) lines each begin with an integer \(n_i\) representing the number of languages for the \(i^{th}\) problem, followed by \(n_i\) space-separated strings corresponding to the programming languages.
The final line contains \(o\) space-separated strings representing the outdated languages.
outputFormat
For each problem, output a single line. If there are any languages remaining after removal of outdated ones, print them in the original order separated by a single space. If none remain, print None
.
2 2
3 Python Java C++
2 Python JavaScript
Python Java
C++
JavaScript
</p>