Timer is Running

Arrange Consonants and Vowels
Submissions: 4376   Accuracy:


  Difficulty: Easy   Marks: 2

Given a singly linked list of size N containing only English Alphabets. Your task is to complete the function arrangeC&V(), that arranges the consonants and vowel nodes of the list it in such a way that all the vowels nodes come before the consonants while maintaining the order of their arrival.

The function takes a single argument as input, the reference pointer to the head of the linked list. There will be T test cases and for each test case the function will be called separately.

For each test case output a single line containing space separated elements of the list.

User Task:
The task is to complete the function arrange() which should arrange the vowels and consonants as required.

1 <= T <= 100
1 <= N <= 100


a e g h i m
q r t

a e i g h m
q r t

Testcase 1
: Vowels like a, e and i are in the front, and consonants like g, h and m are at the end of the list.


** For More Input/Output Examples Use 'Expected Output' option **

Author: harshitsidhwa

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.