Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*package whatever //do not write package name here */
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- import java.math.*;
- class GFG {
- static String str;
- static int n;
- static int character(char c)
- {
- if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
- return 1;
- else
- return 0;
- }
- public static void main (String[] args) throws Exception{
- BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
- str=bf.readLine();
- StringBuffer s=new StringBuffer("");
- n=str.length();
- int ch[]=new int[n];
- for(int i=0;i<n;i++)
- ch[i]=character(str.charAt(i));
- char max=str.charAt(0);
- for(int i=0;i<n-1;i++)
- {
- if(ch[i]==ch[i+1]){
- if(str.charAt(i+1)>max)
- max=str.charAt(i+1);
- continue;
- }
- else{
- s.append(max);
- max=str.charAt(i+1);
- }
- }
- s.append(max);
- System.out.println(s);
- }
- }
Add Comment
Please, Sign In to add comment