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

How we speed up testing and building process of our Ember app at Brandnew? ~2.5x faster!

How to create a responsive contact form using HTML

Functional External VSCode Terminal using Tmux

Useful tools: Postman Mock Servers

Flatiron Portfolio Project — CLI

HOW TO INSTALL MOODLE 3.6.3 ON Ubuntu 18.04/16.04

Consistent Hashing

The Impression Of WordPress 4.9 Features And Review

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

Summary of Chapter 4 Graphs, Algorithms (4th edition), Part 1

Chapter 3 — Primitives and References

Longest Repeating Character Replacement