Given a string str consisting of lowercase English alphabets, the task is to count the number of adjacent pairs of vowels.
Input: str = “abaebio”
(a, e) and (i, o) are the only valid pairs.
Input: str = “aeoui”
Approach: Starting from the first character of the string to the second last character, increment count for every character where str[i] as well as str[i + 1] are both vowels. Print the count in the end which is the required count of pairs.
Below is the implementation of the above approach:
- C++ Program to count Vowels in a string using Pointer
- Count the number of vowels occurring in all the substrings of given string
- Program to count vowels in a string (Iterative and Recursive)
- Queries to find the count of vowels in the substrings of the given string
- Python program to count number of vowels using sets in given string
- Program to count vowels, consonant, digits and special characters in string.
- Count number of equal pairs in a string
- Count pairs of non-overlapping palindromic sub-strings of the given string
- Count pairs of characters in a string whose ASCII value difference is K
- Check if a string can be converted to another string by replacing vowels and consonants
- Count substrings that contain all vowels | SET 2
- First X vowels from a string
- Count strings with consonants and vowels at alternate position
- Reverse vowels in a given string
- Modify the string such that it contains all vowels at least once
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.