【九度OJ】1021【模拟】

来源:互联网 发布:淘宝怎么截图给卖家 编辑:程序博客网 时间:2024/05/22 06:22

代码:

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]);}}}


0 0
原创粉丝点击