Given a string str, the task is to check whether the count of vowels in the given string is prime or not. If its prime then print YES else print NO.
Input: str = “geeksforgeeks”
Count of vowels is 5 (e, e, o, e and e) which is prime.
Input: str = “aeioua”
Approach: Initialize a variable count = 0 and traverse the string character by character, if the current character is a vowel then update count = count + 1. In the end, if count is prime then print YES else print NO.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Minimum changes required such that the string satisfies the given condition
- Find the lexicographically smallest string which satisfies the given condition
- Check if given Binary string follows then given condition or not
- Given a string and an integer k, find the kth sub-string when all the sub-strings are sorted according to the given condition
- Check whether two strings are equivalent or not according to given condition
- Minimum operations required to make the string satisfy the given condition
- Perform range sum queries on string as per given condition
- Count of sub-sequences which satisfy the given condition
- Number of strings that satisfy the given condition
- Check if a string can become empty by recursively deleting a given sub-string
- Check if a given string is sum-string
- Check if the given string is shuffled substring of another string
- Check if left and right shift of any string results into given string
- Check if a given string is a Reverse Bitonic String or not
- Check if given string is a substring of string formed by repeated concatenation of z to a
- Check whether given string can be generated after concatenating given strings
- Restore original String from given Encrypted String by the given operations
- Check if a string can be obtained by rotating another string 2 places
- String slicing in Python to check if a string can become empty by recursive deletion
- Check whether second string can be formed from characters of first string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.