标签:des style blog io color ar for sp div
1 #include <stdio.h> 2 #include <string.h> 3 4 int main(){ 5 char s1[6]; 6 char s2[81]; 7 int s1_length; 8 int s2_length; 9 int i; 10 int j; 11 int time; 12 char c; 13 14 while(1){ 15 i=0; //s1包含空格 16 while((c=getchar())!=‘\n‘){ 17 s1[i]=c; 18 i++; 19 } 20 s1[i]=‘\0‘; 21 22 if(s1[0]==‘#‘) 23 break; 24 25 i=0; //s2包含空格 26 while((c=getchar())!=‘\n‘){ 27 s2[i]=c; 28 i++; 29 } 30 s2[i]=‘\0‘; 31 32 s1_length=strlen(s1); 33 s2_length=strlen(s2); 34 35 for(i=0;i<s1_length;i++){ 36 time=0; 37 for(j=0;j<s2_length;j++){ 38 if(s1[i]==s2[j]) 39 time++; 40 } 41 42 printf("%c %d\n",s1[i],time); 43 } 44 } 45 return 0; 46 }
标签:des style blog io color ar for sp div
原文地址:http://www.cnblogs.com/zqxLonely/p/4066591.html