結果

問題 No.2715 Unique Chimatagram
ユーザー NP
提出日時 2024-04-05 22:27:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,020 KB
実行使用メモリ 65,428 KB
最終ジャッジ日時 2024-10-01 02:40:23
合計ジャッジ時間 7,559 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

def find_string(strings):
    char_count = {}
    for string in strings:
        for char in string:
            char_count[char] = char_count.get(char, 0) + 1
    unique_char = None
    for char, count in char_count.items():
        if count == 1:
            unique_char = char
            break
    if unique_char is None:
        return -1
    for string in strings:
        if unique_char in string:
            string += 'a'
            return ''.join(sorted(string))
N = int(input())
strings = []
for _ in range(N):
    strings.append(input().strip())
result = find_string(strings)
print(result)
0