結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  かに | 
| 提出日時 | 2017-12-17 14:53:42 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 16 ms / 2,000 ms | 
| コード長 | 965 bytes | 
| コンパイル時間 | 2,423 ms | 
| コンパイル使用メモリ | 205,052 KB | 
| 最終ジャッジ日時 | 2025-01-05 05:51:27 | 
| ジャッジサーバーID (参考情報) | judge1 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
ソースコード
#include "bits/stdc++.h"
#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define MP(a,b) make_pair(a,b)
#define PB(a) push_back(a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;
int dp[2000000];
void solve() {
    string s;
    cin >> s;
    set<char> c;
    map<char,int> m;
    rep(i,s.length()){
        c.insert(s[i]);
        m[s[i]] += 1;
    }
    int count = 0;
    char ans;
    for(auto it = c.begin();it != c.end();it++){
        if(m[*it] == 1){
            count++;
            ans = *it;
        }else if(m[*it] >= 3){
            cout << "Impossible" << endl;
            return;
        }
    }
    if(count != 1){
        cout << "Impossible" << endl;
    }else{
        cout << ans << endl;
    }
}
int main() {
    solve();
    return 0;
}
            
            
            
        