Rearrange Vowels

class RearrangeVowels
{
public static void main(String s)
{
s=s+” “;
char vow[]={‘A’,’E’,’I’,’O’,’U’};
int l,i,j,k,wl,sp=0,ep=0;
l=s.length();
String temp1=””, temp2=””,word=””;
for(i=0;i<l;i++)
{
if(s.charAt(i)==’ ‘)
{
ep=i;
word=s.substring(sp,ep);
wl=word.length();

for(j=0;j<5;j++)
{
for(k=0;k<wl;k++)
{
if(vow[j]==word.charAt(k))
{
temp1=temp1+word.charAt(k);
}

}}

for(k=0;k<wl;k++)
{ char ch=word.charAt(k);
if(ch!=’A’ && ch!=’E’ && ch!=’I’ && ch!=’O’ && ch!=’U’)
{
temp2=temp2+word.charAt(k);
}
}
sp=ep+1;
}
System.out.print(temp1+temp2+” “);
temp1=””; temp2=””;

}}}

Comments
  1. jashleen says:

    Very nice program sir

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s