T3000

Func4

Oct 10th, 2022 (edited)
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  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)
  8. {
  9.     for (int i = 0; i < x.size() - 1; i++)
  10.     {
  11.         swap(x.at(i), x.at(i + 1));
  12.         a.insert(x);
  13.         swap(x.at(i), x.at(i + 1));
  14.     }
  15. }
  16.  
  17. int main()
  18. {
  19.     string x;
  20.     cin >> x;
  21.     set<string> a;
  22.     fnc(x, a);
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment