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:
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.
- C++ Program to count Vowels in a string using Pointer
- Count the number of vowels occurring in all the substrings of given string
- Queries to find the count of vowels in the substrings of the given string
- Program to count vowels in a string (Iterative and Recursive)
- 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 characters in a string whose ASCII value difference is K
- Count pairs of non-overlapping palindromic sub-strings of the given string
- Count of pairs of strings whose concatenation forms a palindromic string
- 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 of substrings consisting only of vowels
- Reverse vowels in a given string
- Modify the string such that it contains all vowels at least once
- Count of substrings consisting of even number of vowels
- Longest Subsequence of a String containing only vowels
- Permutations of string such that no two vowels are adjacent
- Program to duplicate Vowels in 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.