백준 #11121번 Communication Channels

jhj·2024년 2월 9일

백준 JAVA

목록 보기
200/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			String a = sc.next();
			String b = sc.next();
			if(a.length() != b.length()) {
				System.out.println("ERROR");
			}else {
				int j;
				for(j = 0; j < a.length(); j++) {
					if(a.charAt(j) != b.charAt(j)) {
						break;
					}
				}
				
				if(j == a.length()) {
					System.out.println("OK");
				}else {
					System.out.println("ERROR");
				}
			}
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글