SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <bits/stdc++.h> | |
| 2 | ||
| 3 | using namespace std; | |
| 4 | using ll = long long; | |
| 5 | using ld = long double; | |
| 6 | ||
| 7 | void fnc(string x, set<string> &a, string alp) | |
| 8 | {
| |
| 9 | for (auto cl : alp) | |
| 10 | {
| |
| 11 | a.insert(cl + x); | |
| 12 | for (int i = 0; i < x.size(); i++) | |
| 13 | {
| |
| 14 | a.insert(x.substr(0, i) + cl + x.substr(i)); | |
| 15 | } | |
| 16 | a.insert(x + cl); | |
| 17 | } | |
| 18 | } | |
| 19 | ||
| 20 | int main() | |
| 21 | {
| |
| 22 | string alp(26, 'a'); | |
| 23 | iota(alp.begin(), alp.end(), 97); | |
| 24 | string x; | |
| 25 | cin >> x; | |
| 26 | set<string> a; | |
| 27 | fnc(x, a, alp); | |
| 28 | return 0; | |
| 29 | } |