xT30x

Func2

Oct 10th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
Add Comment
Please, Sign In to add comment