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

33121번 - Saraga 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB99684368.254%

문제

The word saraga is an abbreviation of sarana olahraga, an Indonesian term for a sports facility. It is created by taking the prefix sara of the word sarana and the suffix ga of the word olahraga. Interestingly, it can also be created by the prefix sa of the word sarana and the suffix raga of the word olahraga.

An abbreviation of two strings $S$ and $T$ is interesting if there are at least two different ways to split the abbreviation into two non-empty substrings such that the first substring is a prefix of $S$ and the second substring is a suffix of $T$.

You are given two strings $S$ and $T$. You want to create an interesting abbreviation of strings $S$ and $T$ with minimum length, or determine if it is impossible to create an interesting abbreviation.

입력

The first line consists of a string $S$ (1ドル ≤ |S| ≤ 200,円 000$).

The second line consists of a string $T$ (1ドル ≤ |T| ≤ 200,円 000$).

Both strings $S$ and $T$ only consist of lowercase English letters.

출력

If it is impossible to create an interesting abbreviation, output -1.

Otherwise, output a string in a single line representing an interesting abbreviation of strings $S$ and $T$ with minimum length. If there are multiple solutions, output any of them.

제한

예제 입력 1

sarana
olahraga

예제 출력 1

saga

You can split saga into s and aga, or sa and ga. The abbreviation saraga is interesting, but saga has a smaller length.

예제 입력 2

berhiber
wortelhijau

예제 출력 2

berhijau

The abbreviation belhijau is also interesting with minimum length, so it is another valid solution.

예제 입력 3

icpc
icpc

예제 출력 3

icpc

예제 입력 4

icpc
jakarta

예제 출력 4

-1

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > The 2024 ICPC Asia Jakarta Regional Contest C번

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

출처

대학교 대회

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

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