Security Code Challange Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Security Code Challange Problem

I dont know what is wrong with this code but all the tests are true except the fourth one. Please help! import java.util.*; public class Program { public static void main(String[] args) { Scanner inp = new Scanner(System.in); String floor = inp.nextLine().replace("x"," "); int count=0; if(floor.contains("T") == false){ System.out.println("quiet"); }else if(floor.contains("$T") || floor.contains("T

quot;)){ System.out.println("ALARM"); } else{ System.out.println("quiet"); } } }

2nd Jul 2020, 6:10 PM
J.K.A
J.K.A - avatar
3 Answers
+ 4
Thanx man it worked
2nd Jul 2020, 6:37 PM
J.K.A
J.K.A - avatar
+ 1
You are replacing x with a space then it's no use to do that, replace with empty character "", And it is security problem not secret message i think... First if condition, according to input is always fails because all inputs contains T, no harm in code but no use...
2nd Jul 2020, 6:35 PM
Jayakrishna 🇮🇳
0
What do you need the count for?
17th Aug 2020, 4:21 PM
Weronika Będuch
Weronika Będuch - avatar