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

32560번 - Amalgram 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB26018615672.897%

문제

An anagram is any arrangement of the letters of a word in which each letter of the alphabet occurs exactly as many times as in the original. For example, clarinets is an anagram of larcenist.

An amalgram is any arrangement of the letters of two words in which each letter of the alphabet occurs at least as many times as in either of the originals. For example, administration is an amalgram of mantis and raisin, although not the shortest possible because the letter d appears in neither.

Given two words, invent an amalgram for them that contains as few letters as possible.

입력

  • One line containing lowercase Latin letters representing the word $a$ (1ドル \le |a| \le 10^6$).
  • One line containing lowercase Latin letters representing the word $b$ (1ドル \le |b| \le 10^6$).

출력

Output a minimally-long sequence of letters that represents an amalgram of $a$ and $b$. If there are multiple answers, you may output any of them. Your answer will be judged as correct if it contains at least all of the letters of $a$ and all of the letters of $b,ドル and there is no other possible answer that could be shorter.

제한

예제 입력 1

hello
world

예제 출력 1

wordhell

예제 입력 2

unclear
instructions

예제 출력 2

lensrustication

예제 입력 3

boring
boring

예제 출력 3

boring

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 A번

  • 문제를 만든 사람: Robin Lee
(追記) (追記ここまで)

출처

대학교 대회

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

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