F003B. Twin numbers

Two natural numbers are twins if the number of appearances of each digit
is the same in each of them. For instance, 25 and 52 are twins, as well
as 1225 and 5212. Neither 7899 and 7889, nor 102 and 12 are twins.

Your task is to write a program that says which numbers do not have any
twin in a given set.

Your program must include and use the function

        bool are_twins(int a, int b);

That indicates if two different natural numbers |a| and |b| are twins.

Input

The input is a sequence of cases. Each case starts with a word that
identifies it, followed by a natural number n, followed by n natural
numbers strictly positive, all different.

Output

For each input case, print a line starting with the case id, followed by
the list of the numbers which are not twins of any other number of the
same case, and ending with the counter of written numbers. The numbers
have to be in the order that they have been given at the input. Follow
the format of the instance.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:27:36.059Z

© Jutge.org, 2006–2026.
https://jutge.org
