시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB55361793130332.755%

문제

씬디는 애너그램(anagram) 프로그램을 만들어 줄 수 있는 남자를 좋아한다. 참고로 씬디는 매우 예쁘다.

애너그램 프로그램이란, 입력받은 영단어의 철자들로 만들 수 있는 모든 단어를 출력하는 것이다. 가령 "abc" 를 입력받았다면, "abc", "acb", "bac", "bca", "cab", "cba" 를 출력해야 한다.

입력받은 단어내에 몇몇 철자가 중복될 수 있다. 이 경우 같은 단어가 여러 번 만들어 질 수 있는데, 한 번만 출력해야 한다. 또한 출력할 때에 알파벳 순서로 출력해야 한다.

입력

첫째 줄에 단어의 개수 N 이, 둘째 줄부터 N개의 영단어가 들어온다. 영단어는 소문자로 이루어져 있다. 단어의 길이는 20보다 작거나 같고, 애너그램의 수가 100,000개 이하인 단어만 입력으로 주어진다.

출력

각각의 영단어마다 모든 가능한 애너그램을 출력한다. 각각의 영단어에 대한 애너그램을 출력할 때, 알파벳 순서로 중복되지 않게 출력한다.

예제 입력 1

2
abc
acba

예제 출력 1

abc
acb
bac
bca
cab
cba
aabc
aacb
abac
abca
acab
acba
baac
baca
bcaa
caab
caba
cbaa
W3sicHJvYmxlbV9pZCI6IjY0NDMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM1NjBcdWIxMDhcdWFkZjhcdWI3YTgiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzUyY1x1YjUxNFx1YjI5NCBcdWM1NjBcdWIxMDhcdWFkZjhcdWI3YTgoYW5hZ3JhbSkgXHVkNTA0XHViODVjXHVhZGY4XHViN2E4XHVjNzQ0IFx1YjljY1x1YjRlNFx1YzViNCBcdWM5MDQgXHVjMjE4IFx1Yzc4OFx1YjI5NCBcdWIwYThcdWM3OTBcdWI5N2MgXHVjODhiXHVjNTQ0XHVkNTVjXHViMmU0LiBcdWNjMzhcdWFjZTBcdWI4NWMgXHVjNTJjXHViNTE0XHViMjk0IFx1YjllNFx1YzZiMCBcdWM2M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c2VzIHZlcnkgcXVpY2tseSB3aXRoIHRoZSBudW1iZXIgb2YgZ2l2ZW4gbGV0dGVycy4gTWFrZSBzdXJlIHlvdSBkbyBub3QgdXNlIGxvbmcgd29yZHMgZm9yIHRlc3RpbmcgeW91ciBwcm9ncmFtIGJlY2F1c2UgdGhlIG91dHB1dCBmaWxlIGNvdWxkIGJlY29tZSB2ZXJ5IGJpZywgd2FzdGUgYSBsb3Qgb2Ygc3BhY2Ugb24gdGhlIGRpc2sgYW5kIGRlZ3JhZGUgdGhlIHBlcmZvcm1hbmNlIG9mIHRoZSBuZXR3b3JrLiZuYnNwOzxcL3A+XHJcbiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCJ9XQ==

출처

ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 1995 E번

  • 잘못된 번역을 찾은 사람: hyunhong1012
  • 문제의 오타를 찾은 사람: jh05013
  • 문제를 번역한 사람: sehun