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.
importjava.io.*;importjava.util.*;importjava.util.regex.Pattern;importjava.util.regex.Matcher;publicclassSolution{publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);Patternpattern=Pattern.compile("hackerrank");intcount=0;while(sc.hasNext()){Matchermatcher=pattern.matcher(sc.next());if(matcher.find())count++;}System.out.println("Number of matches : "+count);}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matching Specific String
You are viewing a single comment's thread. Return to all comments →
Java 15: