Knowee
Questions
Features
Study Tools

First line of input contains T - number of test cases. Its followed by T lines, each line contains a string of size N, containing only lowercase english alphabets.Output FormatFor each test case, print the length of the largest substring that does not contain any vowel, separated by newline.Constraints1 <= T <= 1001 <= N <= 104ExampleInput3smartinterviewsalgorithms

Question

First line of input contains T - number of test cases. Its followed by T lines, each line contains a string of size N, containing only lowercase english alphabets.Output FormatFor each test case, print the length of the largest substring that does not contain any vowel, separated by newline.Constraints1 <= T <= 1001 <= N <= 104ExampleInput3smartinterviewsalgorithms

🧐 Not the exact question you are looking for?Go ask a question

Solution

The problem is asking for the length of the largest substring that does not contain any vowel in a given string. Here are the steps to solve this problem:

  1. Initialize a variable max_length to 0. This will keep track of the maximum length of the substring without vowels.

  2. Iterate over the string from left to right. For each character, check if it is a vowel or not. You can do this by checking if the character is in the set {'a', 'e', 'i', 'o', 'u'}.

This problem has been solved

Similar Questions

Words, Vowels and ConsonantsProblemSubmissionsLeaderboardGiven a sentence containing only uppercase/lowercase english alphabets and spaces, you have to count the number of words, vowels and consonants.Input FormatFirst line of input contains T - number of test cases. Its followed by T lines, each line contains a single sentence.Constraints1 <= T <= 10001 <= len(sentence) <= 104Output FormatFor each test case, print the number of words, vowels and consonants, separated by newline.Sample Input 04HiHello World Exception Hi thereSample Output 01 1 12 3 71 4 52 3 4

Given 2 strings A and B, find the smallest substring of B having all the characters of A, in any order.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each line containing 2 space-separated strings - A and B.Output FormatFor each test case, print the length of the smallest substring of B having all the characters of A, separated by newline. If no such substring is found, print -1.Constraints20 points1 <= T <= 1001 <= size(A), size(B) <= 10060 points1 <= T <= 1001 <= size(A), size(B) <= 1000120 points1 <= T <= 1001 <= size(A), size(B) <= 10000General Constraints'a' <= A[i], B[i] <= 'z'ExampleInput4fkqyu frqkzkruqmfqyuzlkygonmwvytbytn uqhmfjaqtgngcwkuzyamnerphfmwbloets lwbcrsfothplxseplrtbshbtstjloxsfdzpd dclzztpjldkndgbdqqzmbpOutput7-1139ExplanationTest Case 1:The smallest substring containing all characters of A is "fqyuzlk", which has a length of 7.Test Case 2:Despite considering all possible substrings of B, we cannot find any substring containing all characters of A.Test Case 3:The smallest substring containing all characters of A is "bcrsfothplxse", which has a length of 13.Test Case 4:The smallest substring containing all characters of A is "ztpjldknd", which has a length of 9.

Understand the problem statement from the given sample input and output.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each line contains 2 strings A and B, separated by space, consisting only of lowercase English alphabets.Output FormatFor each test case, print the desired output, separated by a new line.Constraints10 points1 <= T <= 1001 <= len(A), len(B) <= 10040 points1 <= T <= 10001 <= len(A) <= 50001 <= len(A), len(B) <= 5000ExampleInput2data structuressmart interviewsOutputsrucuresineview

Given a string of characters, find the first repeating character.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each line contains a single string of characters.Output FormatFor each test case, print the first repeating character, separated by a new line. If there are none, print '.'.Constraints1 <= T <= 1000'a' <= str[i] <= 'z'1 <= len(str) <= 104ExampleInput4datastructuresalgorithmssmartinterviewshackerrankOutputa.sa

Given a string without duplicates, print all the permutations of the string in a lexicographical order.Note:Do not use any inbuilt functions / libraries for your main logic.Input FormatThe first line of input contains T - the number of test cases. It's followed by T lines, each containing a single string consisting only of lowercase English alphabets.Output FormatFor each test case, print the test case number as shown, followed by all the permutations of the string in a lexicographic order, separated by a new line.Constraints1 <= T <= 1001 <= len(str) <= 8ExampleInput2algodsOutputTest Case #1:agloagolalgoalogaoglaolggalogaolglaogloagoalgolalagolaoglgaolgoaloaglogaoagloalgogaloglaolagolgaTest Case #2:dssd

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.