結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-11 23:20:46 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 663 bytes | 
| コンパイル時間 | 5,128 ms | 
| コンパイル使用メモリ | 210,716 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2025-09-11 23:20:53 | 
| 合計ジャッジ時間 | 6,789 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int cnt[26];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(auto it : s)
    {
        cnt[it-'a'] += 1;
    }
    char res = ' ';
    for(int i=0;i<26;i++)
    {
        if(cnt[i]==0) continue;
        if(cnt[i] > 2)
        {
            cout << "Impossible" << '\n';
            return 0;
        }
        if(cnt[i]==1)
        {
            if(res!=' ')
            {
                cout << "Impossible" << '\n';
                return 0;
            }
            res = (char)(i + 'a');
        }
    }
    cout << res << '\n';
    return 0;   
}
            
            
            
        