⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2094.cpp

📁 这是哈尔滨工业大学acmOJ的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 2094 on 2005-10-03 at 17:23:25 */ 
#include <stdio.h>
#include <string.h>
#define  min(a,b)  (((a)<(b))?(a):(b))

int main()
{
	int strA[32], strB[32];
	int i, j, p;
	char ch;
	
	while(1) {
		memset(strA, 0, sizeof(strA));
		memset(strB, 0, sizeof(strB));
		while(1) {
			ch = getchar();
			if(ch == EOF) {
				return 0;
			} else if(ch != '\n') {
				strA[ch-'a']++;
			} else {
				break;
			}
		}
		while(1) {
			ch = getchar();
			if(ch != '\n') {
				strB[ch-'a']++;
			} else {
				break;
			}
		}
		for(i = 0; i < 32; i++) {
			p = min(strA[i],strB[i]);
			for(j = 0; j < p; j++) {
				putchar(i+'a');
			}
		}
		putchar('\n');
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -