コード例 #1
0
  public static void main(String[] args) throws java.lang.Exception {
    // let_me_start

    String s = s();
    String t = s();
    int c[] = new int[150];
    int d[] = new int[150];
    String S = s.toUpperCase();
    String T = t.toUpperCase();
    int C[] = new int[150];
    int D[] = new int[150];

    int n = s.length();
    int m = t.length();

    // int arr[] = is((int)n);

    long ans = 0;
    for (int i = 1; i <= n; i++) {
      c[s.charAt(i - 1)]++;
    }

    for (int i = 1; i <= m; i++) {
      d[t.charAt(i - 1)]++;
    }
    for (int i = 1; i <= n; i++) {
      C[S.charAt(i - 1)]++;
    }

    for (int i = 1; i <= m; i++) {
      D[T.charAt(i - 1)]++;
    }

    int b = 0;
    int min = 1000000000;
    for (int i = 1; i <= 149; i++) {
      b += Math.min(c[i], d[i]);
      d[i] -= Math.min(c[i], d[i]);
    }
    int a = 0;
    min = 1000000000;
    for (int i = 1; i <= 149; i++) {
      a += Math.min(C[i], D[i]);
      D[i] -= Math.min(C[i], D[i]);
    }
    a = a - b;
    out.write("" + b + " " + a + "\n");
    out.flush();
    return;
  }
コード例 #2
0
  public static void main(String[] args) throws java.lang.Exception {
    // let_me_start
    /*  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
     BufferedReader br=new BufferedReader(new FileReader("input.txt"));
        BufferedWriter out=new BufferedWriter(new FileWriter("output.txt"));
    */

    int n = i();
    int m = i();
    // int arr[] = is((int)n);
    // String ans = "NO";
    long ans = 0;
    for (int i = 1; i <= n; i++) {}

    out.write("" + ans + "\n");
    out.flush();
    return;
  }