Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
mark#include<iostream> #include<fstream> #include<string> #include<algorithm> using namespace std; char mm[60]; int main() { // // ifstream cin("0.txt"); int t; cin>>t;string s;int aa[14]; for(int y='A';y<='Z';y++) mm[(y-'A')*2]=y; for(int y='a';y<='z';y++) mm[(y-'a')*2+1]=y; while(t--) { cin>>s;int n=s.length(); for(int i=0;i<n;i++) { if(s[i]>='A'&&s[i]<='Z') aa[i]=2*(s[i]-'A'); else aa[i]=2*(s[i]-'a')+1; } sort(aa,aa+n); for(int i=0;i<n;i++) cout<<mm[aa[i]];cout<<endl; while(next_permutation(aa,aa+n)) {for(int i=0;i<n;i++) cout<<mm[aa[i]];cout<<endl;} } // system("pause"); return 0; }// Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator