結果

問題 No.69 文字を自由に並び替え
ユーザー kuramukuramu
提出日時 2016-01-19 23:49:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,400 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 77,352 KB
実行使用メモリ 49,860 KB
最終ジャッジ日時 2023-09-09 20:44:10
合計ジャッジ時間 3,909 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
49,524 KB
testcase_01 AC 47 ms
47,612 KB
testcase_02 AC 48 ms
49,584 KB
testcase_03 AC 47 ms
49,592 KB
testcase_04 WA -
testcase_05 AC 48 ms
49,556 KB
testcase_06 AC 48 ms
49,672 KB
testcase_07 AC 47 ms
49,608 KB
testcase_08 AC 48 ms
49,860 KB
testcase_09 AC 48 ms
49,588 KB
testcase_10 AC 48 ms
49,664 KB
testcase_11 AC 47 ms
49,524 KB
testcase_12 AC 47 ms
49,392 KB
testcase_13 AC 47 ms
49,676 KB
testcase_14 AC 46 ms
49,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class Main {

	public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      try {
	    	  String a = stdReader.readLine();
	    	  String b = stdReader.readLine();
	    	  ArrayList<String> array = new ArrayList<>();
	    	  HashMap<String, Integer> hashMap = new HashMap<>();
	    	  for(int i=0;i<a.length();i++){
	    		  if(hashMap.containsKey(a.charAt(i))){
	    			  hashMap.put(a, hashMap.get(""+a.charAt(i))+1);
	    		  }else{
	    			  hashMap.put(""+a.charAt(i), 1);
	    			  array.add(""+a.charAt(i));
	    		  }
	    	  }

	    	  HashMap<String, Integer> hashMap2 = new HashMap<>();
	    	  for(int i=0;i<b.length();i++){
	    		  if(hashMap2.containsKey(b.charAt(i))){
	    			  hashMap2.put(b, hashMap2.get(""+b.charAt(i))+1);
	    		  }else{
	    			  hashMap2.put(""+b.charAt(i), 1);
	    		  }
	    	  }
	    	  String result = "YES";
	    	  for(int i=0;i<array.size();i++){
	    		  if(hashMap.get(array.get(i)) != hashMap2.get(array.get(i))){
	    			  result = "NO";
	    			  break;
	    		  }
	    	  }
	    	  
	    	  System.out.println(result);
	    	  } catch (IOException e) {
			e.printStackTrace();
	      }
	}
}
0