Submission #63063524


Source Code Expand

Copy
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.nextLine();
Pattern p = Pattern.compile("W+?A");
Matcher m =p.matcher(S);
while (m.find()) {
int l = m.group().length();
S = S.replaceFirst(m.group(), "A" + "C".repeat(l - 1));
}
System.out.println(S);
sc.close();
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		Pattern p = Pattern.compile("W+?A");
		Matcher m =p.matcher(S);
		
		while (m.find()) {
			int l = m.group().length();
			S = S.replaceFirst(m.group(), "A" + "C".repeat(l - 1));
		}
		
		
		System.out.println(S);
		sc.close();
	}

}

Submission Info

Submission Time
Task C - Debug
User amenokayoubi
Language Java (OpenJDK 17)
Score 0
Code Size 479 Byte
Status TLE
Exec Time 2213 ms
Memory 65724 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
TLE × 18
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 80 ms 38052 KB
example_01.txt AC 73 ms 37956 KB
example_02.txt AC 70 ms 38000 KB
hand_00.txt AC 338 ms 56972 KB
hand_01.txt TLE 2210 ms 47048 KB
hand_02.txt AC 326 ms 57904 KB
hand_03.txt TLE 2210 ms 46796 KB
hand_04.txt AC 72 ms 37768 KB
hand_05.txt AC 71 ms 38000 KB
hand_06.txt AC 277 ms 50304 KB
random_00.txt TLE 2211 ms 65112 KB
random_01.txt TLE 2211 ms 65724 KB
random_02.txt AC 384 ms 62492 KB
random_03.txt AC 795 ms 64352 KB
random_04.txt AC 614 ms 63280 KB
random_05.txt TLE 2210 ms 50880 KB
random_06.txt TLE 2211 ms 58572 KB
random_07.txt TLE 2211 ms 62900 KB
random_08.txt TLE 2209 ms 48808 KB
random_09.txt TLE 2210 ms 46620 KB
random_10.txt AC 1752 ms 63304 KB
random_11.txt TLE 2210 ms 46680 KB
random_12.txt TLE 2210 ms 53080 KB
random_13.txt TLE 2213 ms 49900 KB
random_14.txt TLE 2210 ms 46632 KB
random_15.txt TLE 2210 ms 46908 KB
random_16.txt TLE 2210 ms 46696 KB
random_17.txt TLE 2210 ms 47088 KB
random_18.txt TLE 2211 ms 58064 KB
random_19.txt TLE 2210 ms 49696 KB


2025-04-11 (Fri)
11:54:14 +00:00