// No.548 国士無双 // https://yukicoder.me/problems/no/548 // #include #include #include using namespace std; vector solve(string &S); int main() { cin.tie(nullptr); string S; cin >> S; vector ans = solve(S); if (ans.empty()) cout << "Impossible" << endl; else { for (auto a: ans) cout << a << endl; } } vector solve(string &S) { vector ans; vector candidates {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'}; for (char c: candidates) { string T = S + c; vector count(13, 0); bool match = true; for (char t: T) { if ('a' <= t && t <= 'm') count[t-'a']++; else { match = false; break; } } if (*max_element(count.begin(), count.end()) > 2 || *min_element(count.begin(), count.end()) < 1) match = false; if (match) ans.push_back(c); } return ans; }