Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- //#include <bits/stdc++.h>
- using namespace std;
- const long long MOD = 1e9 + 7;
- const int INF = 2e9;
- int main() {
- int n;
- cin >> n;
- string s;
- cin >> s;
- for(int bitmask = 0; bitmask < (1 << n); bitmask++) {
- string tmp = "";
- for(int i = 0; i < n; i++) {
- if(bitmask & (1 << i)) {
- tmp += s[i];
- }
- }
- cout << tmp << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment