Logo
(追記) (追記ここまで)

17994번 - Swap Free 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB79575678.873%

문제

A set of words is called swap free if there is no way to turn any word in the set into any other word in the set by swapping only a single pair of (not necessarily adjacent) letters.

You are given a set of n words that are all anagrams of each other. There are no duplicate letters in any word. Find the size of the largest swap free subset of the given set. Note that it is possible for the largest swap free subset of the given set to be the set itself.

입력

The first line of input contains a single integer n (1 ≤ n ≤ 500).

Each of the next n lines contains a single word w (1 ≤ |w| ≤ 26).

Every word contains only lower-case letters and no duplicate letters. All n words are unique, and every word is an anagram of every other word.

출력

Output a single integer, which is the size of the largest swap free subset.

제한

예제 입력 1

6
abc
acb
cab
cba
bac
bca

예제 출력 1

3

예제 입력 2

11
alerts
alters
artels
estral
laster
ratels
salter
slater
staler
stelar
talers

예제 출력 2

8

예제 입력 3

6
ates
east
eats
etas
sate
teas

예제 출력 3

4

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2019 Southeast USA Regional Programming Contest > Division 1 D번

ICPC > Regionals > North America > Pacific Northwest Regional > 2019 ICPC Pacific Northwest Region > Division 1 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /