Submission #1516428


Source Code Expand

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		String s3 = scan.next();
		int len1 = s1.length();
		int len2 = s2.length();
		int len3 = s3.length();

		int counta = 0;
		int countb = 0;
		int countc = 0;

		char temp = 'a';
		char ans;
		while (true) {
			if (temp == 'a') {
				if (len1 <= counta) {
					ans = 'A';
					break;
				}
				temp = s1.charAt(counta);
				counta++;
			} else if (temp == 'b') {
				if (len2 <= countb) {
					ans = 'B';
					break;
				}
				temp = s2.charAt(countb);
				countb++;
			} else if (temp == 'c') {
				if (len3 <= countc) {
					ans = 'C';
					break;
				}
				temp = s3.charAt(countc);
				countc++;
			}
		}
		System.out.println(ans);

	}
}

Submission Info

Submission Time
Task B - Card Game for Three (ABC Edit)
User edna
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 873 Byte
Status AC
Exec Time 100 ms
Memory 23508 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status AC
AC × 12
Set Name Test Cases
Sample
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
01.txt AC 99 ms 18644 KB
02.txt AC 99 ms 22996 KB
03.txt AC 89 ms 21716 KB
04.txt AC 99 ms 20560 KB
05.txt AC 97 ms 21716 KB
06.txt AC 87 ms 19796 KB
07.txt AC 89 ms 19412 KB
08.txt AC 87 ms 18516 KB
09.txt AC 88 ms 21716 KB
10.txt AC 100 ms 18900 KB
sample_01.txt AC 87 ms 23508 KB
sample_02.txt AC 87 ms 21716 KB