000 --> nothing
001 --> t
010 --> a
011 --> at
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
bool bit[20];
char s[20];
int i, len;
while (scanf("%s", s) == 1)
{
len = strlen(s);
for (i = 0; i < len; i++)
bit[i] = false;
while (1)
{
i = len-1;
while (i >= 0 && bit[i])
i--;
if (i == -1)
break;
bit[i] = true;
i++;
while (i < len)
{
bit[i] = !bit[i];
i++;
}
for (i = 0; i < len; i++)
if (bit[i])
printf("%c", s[i]);
printf("\n");
}
}
return 0;
}
沒有留言:
張貼留言