Created
February 13, 2014 12:57
-
-
Save KT-Yeh/8974623 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <algorithm> | |
| using namespace std; | |
| int main() | |
| { | |
| ios::sync_with_stdio(false); | |
| int n; | |
| string str; | |
| cin >> n; | |
| while (n--){ | |
| cin >> str; | |
| sort(str.begin(), str.end()); | |
| do{ | |
| for (char &c : str) // c++11 new standard:用來走遍所有元素 | |
| cout << c; | |
| cout << endl; | |
| } while (next_permutation(str.begin(), str.end())); | |
| cout << endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment