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)
- {
- for (int i = 0; i < x.size() - 1; i++)
- {
- swap(x.at(i), x.at(i + 1));
- a.insert(x);
- swap(x.at(i), x.at(i + 1));
- }
- }
- int main()
- {
- string x;
- cin >> x;
- set<string> a;
- fnc(x, a);
- return 0;
- }
Add Comment
Please, Sign In to add comment