結果

問題 No.1192 半部分列
ユーザー lam6er
提出日時 2025-03-26 15:57:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 82,616 KB
実行使用メモリ 75,440 KB
最終ジャッジ日時 2025-03-26 15:58:41
合計ジャッジ時間 2,735 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_subsequence(s, t):
    it = iter(t)
    return all(c in it for c in s)

S = input().strip()
T = input().strip()

if not S:
    print(-1)
    exit()

# Find the lexicographically smallest character in S
min_char = min(S)
# Check if this character exists in T
if min_char not in T:
    print(min_char)
    exit()

# Check if the entire S is a subsequence of T
if is_subsequence(S, T):
    print(-1)
else:
    print(S)
0