結果

問題 No.69 文字を自由に並び替え
ユーザー ribennge
提出日時 2018-08-27 23:33:49
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 893 bytes
コンパイル時間 2,359 ms
コンパイル使用メモリ 77,020 KB
実行使用メモリ 41,172 KB
最終ジャッジ日時 2024-07-05 20:17:44
合計ジャッジ時間 4,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class No_64{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		int cnt = 0;
		int judge1 = 1;
		int judge2 = 1;
		
		for(int i = 0;i < a.length();i++){
			char x = a.charAt(i);
			for(int t = 0;t < a.length();t++){
				char y = b.charAt(t);
				if(x == y){
					break;
				}
				cnt++;
			}
			if(cnt == a.length()){
				judge1 = 0;
				break;
			}
			cnt = 0;
		}
		
		for(int i = 0;i < a.length();i++){
			char x = b.charAt(i);
			for(int t = 0;t < a.length();t++){
				char y = a.charAt(t);
				if(x == y){
					break;
				}
				cnt++;
			}
			if(cnt == a.length()){
				judge2 = 0;
				break;
			}
			cnt = 0;
		}
		
		if(judge1 == 1 && judge2 == 1){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
		
		}
	}
0