結果

問題 No.1909 Detect from Substrings
ユーザー gew1fw
提出日時 2025-06-12 19:51:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 475 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,084 KB
実行使用メモリ 61,788 KB
最終ジャッジ日時 2025-06-12 19:51:36
合計ジャッジ時間 3,819 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
if n > 2:
    print(0)
else:
    s1 = input().strip()
    s2 = input().strip()
    count = 0

    # Check condition A: s1 is prefix, s2 is suffix
    prefix_part = s1[1:]
    suffix_char = s2[-1]
    if prefix_part + suffix_char == s2:
        count += 1

    # Check condition B: s2 is prefix, s1 is suffix
    prefix_part_b = s2[1:]
    suffix_char_b = s1[-1]
    if prefix_part_b + suffix_char_b == s1:
        count += 1

    print(count)
0