Saraga
시간 제한1초메모리 제한2048 MB
S의 접두사와 T의 접미사로 이루어진 분할이 두 가지 이상 존재하는 가장 짧은 문자열을 찾는다.
문제
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 and 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 and the second substring is a suffix of .
You are given two strings and . You want to create an interesting abbreviation of strings and with minimum length, or determine if it is impossible to create an interesting abbreviation.
입력
The first line consists of a string ().
The second line consists of a string ().
Both strings and 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 and with minimum length. If there are multiple solutions, output any of them.