結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー lam6er
提出日時 2025-03-31 17:23:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 467 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 79,576 KB
最終ジャッジ日時 2025-03-31 17:23:59
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input().strip()
unique_chars = list(set(S))

# Since the problem states there are exactly two unique characters, we can safely proceed
count = {}
for c in S:
    count[c] = count.get(c, 0) + 1

# Find which character has a count of 1
target_char = unique_chars[0] if count[unique_chars[0]] == 1 else unique_chars[1]

# Find the 1-based index of the target character
for idx, c in enumerate(S, 1):
    if c == target_char:
        print(f"{idx} {c}")
        break
0