#C5402. Anagram Secret Codes
Anagram Secret Codes
Anagram Secret Codes
You are given a list of secret codes. Your task is to determine whether there exists at least one pair of secret codes that are anagrams of each other.
Recall that two strings s and t are anagrams if their sorted characters are equal. In other words, if we denote the sorted version of a string s by \( sorted(s) \), then two strings are anagrams if:
[ sorted(s) = sorted(t) ]
If there exists at least one pair of secret codes satisfying the above condition, print Anagrams found; otherwise, print Unique codes.
inputFormat
The input is read from stdin
as follows:
- The first line contains an integer N, the number of secret codes.
- The next N lines each contain a secret code (a string without spaces).
outputFormat
Output a single line to stdout
:
- Anagrams found if there exists at least one pair of secret codes that are anagrams of each other.
- Unique codes otherwise.
5
listen
silent
enlist
hello
world
Anagrams found