[C#] проблема, связанная с гласными и согласными
Madhan has been a given a problem by his brother Jayi .The problem is related to strings. Now he gives Madhan a long String S which consists of lowercase English Alphabets and wants him to tell the minimum size of substring such that all the substrings of that size in S have at least K Consonants(Non-vowels) in them. If none of the subArray size satisfy the above condition ,return -1. Input Format Your function contains two arguments a String S and an Integer K. First line of input contains a String S. Second line of input contains an Integer K. Constraints 1 <= |S| <= 100000 1 <= K <= 10000 Output Format You must return an Integer denoting the answer to the problem. Sample TestCase 1 Input: ritikisagoodboy 4 Output: 9 Explanation All substrings of length 9 have greater or equal to 4 non-vowels in them and this is the minimum size that we can have. In substring of size 8 .. the substring ''ikisagoo'' has only 3 non-vowels therefore it violates the condition.
Что я уже пробовал:
using System; using System.Collections.Generic; using System.IO; using System.Linq; class CandidateCode { static int Consonant(string input1,int input2) { //code to be written } static void Main(String[] args) { int output; string ip1; ip1 = Console.ReadLine(); int ip2; ip2 = Convert.ToInt32(Console.ReadLine()); output = Consonant(ip1,ip2); Console.WriteLine(output); }
Не мог бы кто-нибудь помочь мне в решении этой проблемы?...