結果
| 問題 | No.587 七対子 | 
| コンテスト | |
| ユーザー |  ats5515 | 
| 提出日時 | 2017-11-03 22:27:48 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 684 bytes | 
| コンパイル時間 | 680 ms | 
| コンパイル使用メモリ | 85,028 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-19 19:39:37 | 
| 合計ジャッジ時間 | 1,444 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:14: warning: ‘res’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         char res;
      |              ^~~
            
            ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	vector<int> A(26, 0);
	char res;
	for (int i = 0; i < 13; i++) {
		A[(int)(S[i] - 'a')]++;
	}
	int c = 0;
	bool f = true;
	for (int i = 0; i < 26; i++) {
		if (A[i] == 1) {
			c++;
			res = i + 'a';
		}
		else if (A[i] > 2) {
			f = false;
		}
	}
	if (c != 1) {
		f = false;
	}
	if (f) {
		cout << res << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
}
            
            
            
        