Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

while (scanf ( "%s%s", &A, &B )!=EOF)

Posted by wanpiOuser at 2005-12-27 22:38:28 on Problem 2629
In Reply To:Why OLE? Posted by:songuno1 at 2005-12-27 22:34:13
>  #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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator