0
4th case is failing only in security code couch program
7 Respostas
+ 2
If you're going to post your code, please save it in the code playground and link to it in your post.
+ 1
Remove everything but G, $, and T from the input string. Check remaining string for "$T" or "Tquot; if there output "ALARM" else output "quiet"
+ 1
So here it is half half
0
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
int m=str.indexOf('#x27;);
int cg=0,ct=0;
char c[]=new char[str.length()];
for(int i=0;i<str.length();i++)
{
c[i]=str.charAt(i);
if(i<m)
{
if(c[i]=='G')
cg=i+1;
else if(c[i]=='T')
ct=i+1;
else
{
cg=m+1-cg;
ct=m+1-ct;
if(cg>ct)
{ System.out.println("ALARM"); break;}
else
{ System.out.println("quiet"); break;}
}
}
cg=str.length();
if(i>m)
{
if(c[i]=='G')
cg=i+1;
else if(c[i]=='T')
ct=i+1;
if(i==st
0
Bro my code is not fiitting here
0
if(i==str.length()-1)
{
cg=cg-m-1;
ct=ct-m-1;
if(cg>ct)
{ System.out.println("ALARM");break;}
else
{ System.out.println("quiet"); break;}
}
}
}
}
}
0
Ok thanks