結果

問題 No.1909 Detect from Substrings
コンテスト
ユーザー gew1fw
提出日時 2025-06-12 19:51:24
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 475 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 245 ms
コンパイル使用メモリ 95,344 KB
実行使用メモリ 83,200 KB
最終ジャッジ日時 2026-07-11 22:41:16
合計ジャッジ時間 5,105 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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