#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i bool chmin(T& a, T b){ if(a > b){a = b; return true;} return false; } template bool chmax(T& a, T b){ if(a < b){a = b; return true;} return false; } template T gcd(T a, T b){ return a % b ? gcd(b, a % b) : b; } template T lcm(T a, T b){ return a / gcd(a, b) * b; } vector> run_length(string s){ int n = s.size(); vector> res; char pre = s[0]; int cnt = 1; rep(i, 1, n){ if(s[i] == pre){ ++cnt; }else{ res.push_back({pre, cnt}); pre = s[i], cnt = 1; } } res.push_back({pre, cnt}); return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; sort(all(s)); auto rle = run_length(s); if(rle.size() != 7){ cout << "Impossible" << endl; return 0; } char ans = '?'; for(auto [c, l] : rle){ if(!(l == 1 || l == 2)){ cout << "Impossible" << endl; return 0; } if(l == 1){ if(ans != '?'){ cout << "Impossible" << endl; return 0; } ans = c; } } cout << ans << endl; return 0; }