Strong Language (SSCRIPT) Solution — Codechef April Long Challenge

Input

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first line of each test case contains two space-separated integers N and K.
  • The second line contains a single string S with length N.

Output

Constraints

  • 1≤T≤10
  • 1≤K≤N≤10⁶
  • S contains only lowercase English letters and characters ‘*’
  • Sum of N over all testcases is atmost 10⁶.

Subtasks

Example Input

3
5 2
*a*b*
5 2
*a**b
5 1
abcde

Example Output

NO
YES
NO

Explanation

/* package codechef; // don't place package name! */import java.util.*;import java.lang.*;import java.io.*;/* Name of the class has to be "Main" only if the class is public. */class Codechef{public static void main (String[] args) throws java.lang.Exception{Scanner sc = new Scanner(System.in);int t = sc.nextInt();while(t-- > 0){int n = sc.nextInt();int k = sc.nextInt();sc.nextLine();String str = sc.next();int count=0,cnti=0;for(int i=0;i<n;i++){if(str.charAt(i)=='*'){count++;if(count==k){System.out.println("YES");cnti++;break;}}elsecount =0;}if(cnti == 0)System.out.println("NO");}}}

--

--

--

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

TutorCruncher Telleroo Updates

From The Bootstrap Garbage Bin: “Sticky Footer” and “Pricing”

zkTube Testnet Mining Phase II Rewards Launches

Don’t be afraid to take part in Hackathons as a ‘non-techie’

Experience with getting started to Software Development Life Cycle:)

Testing and the Future of NinjaChat

Connext routers

Is your Scala object always a singleton?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anubhav Mishra

Anubhav Mishra

Software Developer ,currently pursuing B.Tech in Information Technology. Electronic Dance Music is love.Also like all phone related technologies

More from Medium

Java 學習記錄109 — Introduction to SQLite

Why Java is platform independent

What is the difference between “.equals()” vs “==” in java

Why Learn Java in 2021