Untitled
unknown
c_cpp
2 months ago
1.3 kB
5
Indexable
Never
#include "bits/stdc++.h" // @JASPER'S BOILERPLATE using namespace std; using ll = long long; #define FOR(i, a, b) for(int i = a; i <= b; i++) #define FORD(i, a, b) for(int i = a; i >= b; i--) #define REP(i, b) for(int i = 0; i < b; i++) #define PER(i, b) for(int i = b - 1; i >= 0; i--) #define fi first #define se second #ifdef JASPER2 #include "debug.h" #else #define debug(...) 166 #endif // #define int long long using pii = pair < int, int >; const int INF = 1e9; const ll MOD = 998244353; const int N = 2e5 + 5; string s; map <char, string> mp; int n; vector <string> ans; void solve(int i, string cur) { if (i == n) { ans.push_back(cur); return; } for (auto x : mp[s[i]]) solve(i + 1, cur + x); } void run_case() { cin >> s; sort(s.begin(), s.end()); n = s.size(); mp['2'] = "abc"; mp['3'] = "def"; mp['4'] = "ghi"; mp['5'] = "jkl"; mp['6'] = "mno"; mp['7'] = "pqrs"; mp['8'] = "tuv"; mp['9'] = "wxyz"; solve(0, ""); sort(ans.begin(), ans.end()); for (auto x : ans) cout << x << " "; } signed main() { cin.tie(0) -> sync_with_stdio(0); #ifdef JASPER2 freopen("in1", "r", stdin); #endif int Test = 1; // cin >> Test; for (int test = 1; test <= Test; test++){ run_case(); } }