Arrange Consonants and Vowels
Submissions: 2668   Accuracy:

33.34%

  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.
Examples:

Input : a -> b -> c -> e -> d -> o -> x -> i
Output : a -> e -> o -> i -> b -> c -> d -> x 

Input:
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.


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


Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

2
6
a e g h i m
3
q r t
Output:
a e i g h m
q r t

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

** 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.