#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 15
char *s, *w;
int n;
void
placement(int x)
{
int i;
char t;
if (x == 0) {
for(i=0; i<n-1; i++) {
}
return;
}
for (i = n; i; i--) {
if (s[i - 1] == ' ')
continue;
w[x - 1] = s[i - 1];
t = s[i - 1];
s[i - 1] = ' ';
placement(x - 1);
s[i - 1] = t;
}
}
int
main(int argc, char **argv)
{
s
= malloc(sizeof(char) * (N
+ 1)); w
= malloc(sizeof(char) * (N
+ 1)); placement(n);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKI2RlZmluZSBOIDE1CmNoYXIgICAgICAgICAgICpzLCAqdzsKaW50ICAgICAgICAgICAgIG47Cgp2b2lkCnBsYWNlbWVudChpbnQgeCkKewogIGludCAgICAgICAgICAgICBpOwogIGNoYXIgICAgICAgICAgICB0OwoKICBpZiAoeCA9PSAwKSB7CiAgICBmb3IoaT0wOyBpPG4tMTsgaSsrKSB7CiAgICAgIHByaW50ZigiJWMsIiwgd1tpXSk7CiAgICB9CiAgICBwcmludGYoIiVjXG4iLCB3W2ldKTsKICAgIHJldHVybjsKICB9CiAgZm9yIChpID0gbjsgaTsgaS0tKSB7CiAgICBpZiAoc1tpIC0gMV0gPT0gJyAnKQogICAgICBjb250aW51ZTsKICAgIHdbeCAtIDFdID0gc1tpIC0gMV07CiAgICB0ID0gc1tpIC0gMV07CiAgICBzW2kgLSAxXSA9ICcgJzsKICAgIHBsYWNlbWVudCh4IC0gMSk7CiAgICBzW2kgLSAxXSA9IHQ7CiAgfQp9CgppbnQKbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKICBuID0gYXRvaShhcmd2WzFdKTsKICBzID0gbWFsbG9jKHNpemVvZihjaGFyKSAqIChOICsgMSkpOwogIHN0cm5jcHkocywgImFiY2RlZmdoaWprbG1ubyIsIG4pOwogIHcgPSBtYWxsb2Moc2l6ZW9mKGNoYXIpICogKE4gKyAxKSk7CiAgc3RyY3B5KHcsIHMpOwogIHBsYWNlbWVudChuKTsKCiAgcmV0dXJuIDA7Cn0=