My issue
In week 3 i have submitted this before the deadline but it was showing time limit exceeded
i conveyed this problem my faculty also
now i have completed all the weeks in week 3 second module is showing this
now i completed 99% remaining percent this error
please solve the issues
My code
# Function to check if a given string contains all vowels
def contains_all_vowels(substring):
vowels = set('aeiou')
return all(c in vowels for c in substring)
# Function to determine if Chef is happy or not for a given string S
def is_chef_happy(S):
for i in range(len(S) - 2):
for j in range(i + 3, len(S) + 1):
substring = S[i:j]
if contains_all_vowels(substring):
return True
return False
# Input the number of test cases
num_test_cases = int(input())
# Process each test case
for _ in range(num_test_cases):
# Input the string S
S = input().strip()
# Check if Chef is happy or not and print the result
if is_chef_happy(S):
print("HAPPY")
else:
print("SAD")
Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone