| ||||||||||
| 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 OLE? #include <stdio.h>
#include <string.h>
char A[1001], B[1001];
void process (){
int i, u;
int a[26]={0,}, b[26]={0,};
for (i=0; i<strlen ( A ); i++) a[A[i]-'a']++;
for (i=0; i<strlen ( B ); i++) b[B[i]-'a']++;
for (i=0; i<26; i++){
for (u=0; u<a[i] && u<b[i]; u++){
printf ( "%c", i+'a' );
}
}
printf ( "\n" );
}
int main (){
while (scanf ( "%s%s", &A, &B )){
if (!A[0] || !B[0]) return 0;
process ();
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator