Write a program that will take one string as input. The program will then remove vowels a, e, i, o, u from the string. If there are two or more than two vowels that occur together then the program shall ignore all of those vowels.


Sample input:

Cat

Sample output:

Ct

 

Sample input:

Heel

Sample Output:

Heel

Execution Time limit:

  • 10 Sec

 

Code:

x=input()
array=[]
array2=["a","e","i","o","u"]
for i in range(len(x)):
    array.append(x[i])
for k in range(len(array)-1):
    if array[k] in array2:
        if array[k+1] == array[k]:
            break;
        else:
            array.remove(array[k])
print('.join(array))



Share to whatsapp

More Questions from Entrance Exam Questions Module 1

Primes with a Twist
Given an integer n(1<=n<=10^4), you need to count the numbers, x,< n, which are co-prime to 'n', i.e. gcd(x,n)=1.
Formally, given n, you need to find f(n)=[{x<n:gcd(x,n)=1}].
Return the count of the number of co-primes of 'n'.
View
"Farway Home" is an online platform where users can buy property. This platform has a list of N plots numbered 0 to (N-1). The list consist of the specified area for each plot. The platform provides an application where a user can identify the plots with the Kth largest area from the list.
Write an algorithm to find the plot with the Kth largest area.
Input The first line of the input consists of an integer-size, representing the number of plats (N). The second line consists of N space separated integers-areas0, area1 ...... areaN-1, representing the areas of the plots.
The last line consists of an integer value, representing the value for which the user wishes to find the area (K).
View
Write a program that will take one string as input. The program will then remove vowels a, e, i, o, u from the string. If there are two or more than two vowels that occur together then the program shall ignore all of those vowels.
View