Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- void fnc(string x, set<string> &a, string alp)
- {
- for (auto cl : alp)
- {
- a.insert(cl + x);
- for (int i = 0; i < x.size(); i++)
- {
- a.insert(x.substr(0, i) + cl + x.substr(i));
- }
- a.insert(x + cl);
- }
- }
- int main()
- {
- string alp(26, 'a');
- iota(alp.begin(), alp.end(), 97);
- string x;
- cin >> x;
- set<string> a;
- fnc(x, a, alp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment