結果

問題 No.587 七対子
ユーザー wgrape
提出日時 2025-03-12 15:34:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 82,636 KB
実行使用メモリ 55,584 KB
最終ジャッジ日時 2025-03-12 15:34:16
合計ジャッジ時間 3,139 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
from collections import defaultdict
dic = defaultdict(int)

for s in S:
    dic[s] += 1

p1 = 0
p2 = 0
ans = ""
for key, value in dic.items():
    if value == 2:
        p2 += 1
    elif value == 1:
        p1 += 1
        ans = key
    else:
        print("Impossible")
        break
else:
    if p1 == 1:
        print(ans)
    else:
        print("Impossible")
0