| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why Output Limit Exceed?(程序入内)#include <stdio.h>
#include <string.h>
int min(int x , int y)
{
return x > y ? y : x;
}
int main()
{
int num1[26] , num2[26];
char s[2010] , i , j;
while (gets(s))
{
//if (s[0] == 0) break;
i = 0;
memset(num1 , 0 , sizeof(num1));
while (s[i] > 0) {if ((s[i] >= 'a') && (s[i] <= 'z')) num1[s[i] - 'a'] ++; i ++;}
gets(s);
i = 0;
memset(num2 , 0 , sizeof(num2));
while (s[i] > 0) {if ((s[i] >= 'a') && (s[i] <= 'z')) num2[s[i] - 'a'] ++; i ++;}
for (i = 0; i < 26; i ++)
for (j = 0; j < min(num1[i] , num2[i]); j ++)
printf("%c" , i + 'a');
printf("\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator