We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I have written a code which runs fine on my JAVA IDE, but saying ~no response~ in the output on the site. The code is given below:
importjava.io.*;importjava.util.*;importjava.text.*;importjava.math.*;importjava.util.regex.*;publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Stringthe1Regex="\\bpublic\\sclass\\b";Stringthe2Regex="\\bmain\\b";Scannersc=newScanner(System.in);StringinputString=sc.next();PatterncheckRegex=Pattern.compile(the1Regex);PatterncheckRegex1=Pattern.compile(the2Regex);MatcherregexMatcher=checkRegex.matcher(inputString);MatcherregexMatcher1=checkRegex1.matcher(inputString);if(regexMatcher.find()){if(regexMatcher.group().length()!=0){System.out.println(inputString.substring(regexMatcher.end()+1,inputString.indexOf('{')));}}elseif(regexMatcher1.find()){if(regexMatcher1.group().length()!=0){System.out.println(inputString.substring(0,regexMatcher1.start()).substring(inputString.substring(0,regexMatcher1.start()).indexOf('c')+6,inputString.substring(0,regexMatcher1.start()).indexOf('{')));}}}}
I have written a code which runs fine on my JAVA IDE, but saying ~no response~ in the output on the site. The code is given below:
I have done with primary class AA and a method classname and got a proper answere but still it's showing wrong answere. why?