[C++] 纯文本查看 复制代码 #include <bits/stdc++.h>
using namespace std;
int main( )
{
char ch[26][5];
strcpy(ch[0],"*-");
strcpy(ch[1],"-***");
strcpy(ch[2],"-*-*");
strcpy(ch[3],"-**");
strcpy(ch[4],"*");
strcpy(ch[5],"**-*");
strcpy(ch[6],"--*");
strcpy(ch[7],"****");
strcpy(ch[8],"**");
strcpy(ch[9],"*---");
strcpy(ch[10],"-*-");
strcpy(ch[11],"*-**");
strcpy(ch[12],"--");
strcpy(ch[13],"-*");
strcpy(ch[14],"---");
strcpy(ch[15],"*--*");
strcpy(ch[16],"--*-");
strcpy(ch[17],"*-*");
strcpy(ch[18],"***");
strcpy(ch[19],"-");
strcpy(ch[20],"**-");
strcpy(ch[21],"***-");
strcpy(ch[22],"*--");
strcpy(ch[23],"-**-");
strcpy(ch[24],"-*--");
strcpy(ch[25],"--**");
int i=0;
char c;
char str[500];
while(scanf("%c",&c)!=EOF)
{
if(c=='|'||c=='\n')
{
str[i]='\0';
for(int j=0;j<26;j++)
{
if(strlen(str)==strlen(ch[j]))
if(!strncmp(str,ch[j],strlen(ch[j])))
{
printf("%c",j+'A');
break;
}
}
i=0;
continue;
}
str[i++]=c;
}
return 0;
} |