시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 463 172 130 41.801%

문제

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

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

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

입력

첫째 줄에 단어의 개수 N 이, 둘째줄부터 N개의 영단어가 들어온다. 영단어는 대소문자로 이루어져 있고, 대문자와 소문자는 구별해야 한다.

출력

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

예제 입력 1

2
abc
acba

예제 출력 1

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

출처

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

  • 문제의 오타를 찾은 사람: jh05013
  • 문제를 번역한 사람: sehun