Code Names
면접 대비시간 제한1초메모리 제한1024 MB
중복 없는 글자로 이루어진 N개의 애너그램이 주어질 때, 한 쌍의 글자만 바꿔서 서로 변환되지 않는 가장 큰 부분집합의 크기를 구한다.
문제
You are given , a set of words that are anagrams of each other. There are no duplicate letters in any word. A set of words is called "swap-free" if there is no way to turn a word into another word by swapping only a single pair of (not necessarily adjacent) letters in . Find the size of the largest swap-free set chosen from the given set .
입력
The first line of input contains an integer (). Following that are lines each with a single word. Every word contains only lowercase English letters and no duplicate letters. All words are unique, have at least one letter, and every word is an anagram of every other word.
출력
Output the size of the largest swap-free set.