結果

問題 No.587 七対子
ユーザー nCk_cv
提出日時 2017-12-31 17:53:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 77,048 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 15:31:03
合計ジャッジ時間 2,248 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <string>

using namespace std;

void solve();

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}

void solve() {
    string s;
    cin >> s;
    int count[26];
    for(int i = 0; i < 26; i++) {
        count[i] = 0;
    }
    for(int i = 0; i < s.length(); i++) {
        count[s[i] - 'a']++;
    }
    int ind = -1;
    for(int i = 0; i < 26; i++) {
        if(count[i] == 1) {
            if(ind == -1) ind = i;
            else ind = -2;
        } 
    }
    if(ind == -2 || ind == -1) cout << "Impossible" << endl;
    else cout << (char)('a' + ind) << endl;


    
}
0