#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstring>
using namespace std;
char in[1000];
int cmp(const void *a, const void*b)
{
return *(char*)a-*(char*)b;
}
bool comp(const char &a, const char &b)
{
int delta = tolower(a) - tolower(b);
return delta?delta<0:a<b;
}
int main()
{
int test, len;
scanf("%d",&test);
getchar();
while (test--)
{
gets(in);
len = strlen(in);
sort(in,in+len,comp);
do
{
cout << in << endl;
} while (next_permutation(in,in+len,comp));
}
return 0;
}
Thursday, November 10, 2011
[UVa] 195 - Anagrams
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.