简单字符串,读懂题,很容易AC。
#include <stdio.h>
#include <string.h> char buf[], line[], des[]; int main() {
int i, k, tmp, len;
int ib, id; memset(buf, , sizeof(buf));
ib = ; while (gets(line) != NULL) {
len = strlen(line);
if (len== && line[]=='#')
break;
if (len== && line[]=='*') {
id = ;
for (i=; i<ib; i+=) {
tmp = (buf[i]<<) + (buf[i+]<<) + (buf[i+]<<) + (buf[i+]<<) + (buf[i+]);
if (tmp == )
des[id] = ' ';
else if (tmp == )
des[id] = '\'';
else if (tmp == )
des[id] = ',';
else if (tmp == )
des[id] = '-';
else if (tmp == )
des[id] = '.';
else if (tmp == )
des[id] = '?';
else
des[id] = tmp-+'A';
++id;
}
des[id] = '\0';
printf("%s\n", des);
ib = ;
memset(buf, , sizeof(buf));
} else {
k = ;
for (i=; i<len; ++i) {
if (k && line[i]!=' ') {
buf[ib++] = !(k&);
k = ;
} else if (line[i] == ' '){
++k;
}
}
}
} return ;
}