Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <vector>
- #include <algorithm>
- #include <map>
- using namespace std;
- int main() {
- string s;
- cin >> s;
- map<string, bool> visited;
- sort(s.begin(), s.end());
- int res = 0;
- do {
- if(s[0] != '0' and !visited[s]) {
- visited[s] = true;
- res++;
- }
- } while(next_permutation(s.begin(), s.end()));
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement