結果

問題 No.587 七対子
ユーザー brthyyjp
提出日時 2020-07-07 04:05:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 53,632 KB
最終ジャッジ日時 2024-07-19 20:14:40
合計ジャッジ時間 2,598 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

s = list(str(input()))
from collections import Counter
C = Counter(s)
D = list(C.items())
D.sort(key=lambda x: x[1])
if len(D) != 7:
    print('Impossible')
    exit()

for i in range(7):
    k, v = D[i]
    if i == 0:
        if v != 1:
            print('Impossible')
            exit()
        else:
            ans = k
    else:
        if v != 2:
            print('Impossible')
            exit()
else:
    print(ans)
0