#C13566. Remove Duplicate Sublists
Remove Duplicate Sublists
Remove Duplicate Sublists
You are given a list of sublists consisting of integers. Your task is to remove duplicate sublists while preserving the order of their first occurrence. Two sublists are considered duplicates if they contain the same integers in the same order.
Formally, given a sequence of sublists (L_1, L_2, \ldots, L_n), produce a new sequence (R_1, R_2, \ldots, R_k) such that for every sublist (L_i) that appears for the first time in the input, it is included in the result, and any subsequent occurrence is ignored.
For example, if the input is [[1, 2, 3], [2, 3, 4], [1, 2, 3], [5, 6], [2, 3, 4]], the answer is [[1, 2, 3], [2, 3, 4], [5, 6]].
inputFormat
The input is read from standard input and has the following format:
• The first line contains an integer (n) representing the number of sublists.
• The next (n) lines each describe a sublist. Each line begins with an integer (m), the number of elements in the sublist, followed by (m) space-separated integers.
It is guaranteed that (0 \leq n \leq 10^5) and the sum of all (m) does not exceed (10^5).
outputFormat
The output is printed to standard output. The first line should contain an integer representing the number of sublists in the deduplicated sequence. Each of the following lines should contain the elements of a sublist separated by a single space, in the order they appear in the deduplicated sequence.## sample
5
3 1 2 3
3 2 3 4
3 1 2 3
2 5 6
3 2 3 4
3
1 2 3
2 3 4
5 6
</p>