代码:
package Test1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test33_1021 {
/**
* by qr jobdu 1021 2014-8-19
* @throws IOException
*/
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str1,str2;
int len1,len2;
while(true){
str1=br.readLine();
if(str1.equals("#"))
break;
str2=br.readLine();
len1=str1.length();
len2=str2.length();
int num[]=new int[len1];
for(int i=0;i<len2;i++){
char temp2=str2.charAt(i);
for(int j=0;j<len1;j++){
char temp1=str1.charAt(j);
if(temp1==temp2)
num[j]++;
}
}
for(int i=0;i<len1;i++)
System.out.println(str1.charAt(i)+" "+num[i]);
}
}
}