{"problem":{"name":"A. Remove Duplicates","description":{"content":"Petya has an array $a$ consisting of $n$ integers. He wants to remove duplicate (equal) elements. Petya wants to leave only the rightmost entry (occurrence) for each element of the array. The relativ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF978A"},"statements":[{"statement_type":"Markdown","content":"Petya has an array $a$ consisting of $n$ integers. He wants to remove duplicate (equal) elements.\n\nPetya wants to leave only the rightmost entry (occurrence) for each element of the array. The relative order of the remaining unique elements should not be changed.\n\n## Input\n\nThe first line contains a single integer $n$ ($1 \\le n \\le 50$) — the number of elements in Petya's array.\n\nThe following line contains a sequence $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 1\\,000$) — the Petya's array.\n\n## Output\n\nIn the first line print integer $x$ — the number of elements which will be left in Petya's array after he removed the duplicates.\n\nIn the second line print $x$ integers separated with a space — Petya's array after he removed the duplicates. For each unique element only the rightmost entry should be left.\n\n[samples]\n\n## Note\n\nIn the first example you should remove two integers $1$, which are in the positions $1$ and $4$. Also you should remove the integer $5$, which is in the position $2$.\n\nIn the second example you should remove integer $2$, which is in the position $1$, and two integers $4$, which are in the positions $2$ and $4$.\n\nIn the third example you should remove four integers $6$, which are in the positions $1$, $2$, $3$ and $4$.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Petya 有一个由 $n$ 个整数组成的数组 $a$。他希望移除重复（相等）的元素。\n\nPetya 希望为数组中的每个元素只保留最右侧的出现（出现位置）。剩余唯一元素的相对顺序不应改变。\n\n第一行包含一个整数 $n$（$1 lt.eq n lt.eq 50$）——Petya 数组中元素的个数。\n\n接下来的一行包含一个序列 $a_1, a_2, dots.h, a_n$（$1 lt.eq a_i lt.eq 1 thin 000$）——Petya 的数组。\n\n在第一行输出整数 $x$ —— Petya 移除重复元素后数组中剩余的元素个数。\n\n在第二行输出 $x$ 个用空格分隔的整数 —— Petya 移除重复元素后的数组。对于每个唯一元素，只保留其最右侧的出现。\n\n在第一个例子中，你应该移除位置 $1$ 和 $4$ 上的两个整数 $1$。你还应该移除位置 $2$ 上的整数 $5$。\n\n在第二个例子中，你应该移除位置 $1$ 上的整数 $2$，以及位置 $2$ 和 $4$ 上的两个整数 $4$。\n\n在第三个例子中，你应该移除位置 $1$、$2$、$3$ 和 $4$ 上的四个整数 $6$。\n\n## Input\n\n第一行包含一个整数 $n$（$1 lt.eq n lt.eq 50$）——Petya 数组中元素的个数。接下来的一行包含一个序列 $a_1, a_2, dots.h, a_n$（$1 lt.eq a_i lt.eq 1 thin 000$）——Petya 的数组。\n\n## Output\n\n在第一行输出整数 $x$ —— Petya 移除重复元素后数组中剩余的元素个数。在第二行输出 $x$ 个用空格分隔的整数 —— Petya 移除重复元素后的数组。对于每个唯一元素，只保留其最右侧的出现。\n\n[samples]\n\n## Note\n\n在第一个例子中，你应该移除位置 $1$ 和 $4$ 上的两个整数 $1$。你还应该移除位置 $2$ 上的整数 $5$。在第二个例子中，你应该移除位置 $1$ 上的整数 $2$，以及位置 $2$ 和 $4$ 上的两个整数 $4$。在第三个例子中，你应该移除位置 $1$、$2$、$3$ 和 $4$ 上的四个整数 $6$。","is_translate":true,"language":"Chinese"}],"meta":{"iden":"CF978A","tags":["implementation"],"sample_group":[["6\n1 5 5 1 6 1","3\n5 6 1"],["5\n2 4 2 4 4","2\n2 4"],["5\n6 6 6 6 6","1\n6"]],"created_at":"2026-03-03 11:00:39"}}