+ 2

Whats wrong with my code ?!

import java.util.Scanner; public class Program{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); String str = sc.nextLine(); str = str.replace('x', '\u0000'); if(str.contains("$T")==true || str.contains("T

quot;)==true){ System.out.println("ALARM"); } else{ System.out.println("quiet"); } sc.close(); } } The question is from CodeCoach Security problem

22nd Dec 2021, 6:18 AM
I.K.I.A.T.L
1 ответ
+ 1
Congratulations, nice idea 👍 Try it this way: str = str.replace("x", ""); This \u0000 will only not be printed, but is still there and will be considered as contained in the string.
22nd Dec 2021, 9:32 PM
Coding Cat
Coding Cat - avatar