PersonalCorpus 版 (精华区)

1245607 Big Guava ... 10252 Accepted
0:00.002 64 2002/11/18 05:46:18.207

void main()
{
#ifndef ONLINE_JUDGE
    freopen("k:\\uva\\i10252","r",stdin);
    freopen("k:\\uva\\o10252","w",stdout);
#endif

    int i,j,k;
    char s[1010],t[1010];
    int c[26],d[26];


    while (gets(s)!=NULL) {
        gets(t);
        memset(c,0,sizeof(c));
        memset(d,0,sizeof(d));
        for (i=0;s[i];i++) c[s[i]-'a']++;
        for (i=0;t[i];i++) d[t[i]-'a']++;
        for (i=0;i<26;i++) if (c[i]&&d[i]) {
            if (c[i]>d[i]) k=d[i];else k=c[i];
            while (k--) printf("%c",i+'a');
        }
        printf("\n");
    }
}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.014毫秒