Piglatin

sravan953 0 Tallied Votes 137 Views Share

Word: 'trouble'
First vowel encountered: 'o'
Therefore, the Piglatin version: 'oubletray'

(From the first vowel till the last letter, concatenated with the first few letters which(or were not) left out, which concatenated with a standard 'ay')

So, the Piglatin form of 'sravan953' would be: 'avan953sray'

import java.io.*;
class piglatin
{
static void pig()throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the word for which you want to get the piglatin form of:\n");
        String s=br.readLine();
        int l=s.length(),n=0;
        String s1="";
        for(int j=0;j<l;j++)
            {
                char c=s.charAt(j);
                if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
                    {
                        s1=s.substring(j);
                        s1=s1+(s.substring(0,j));
                        break;
                    }
                }
                s1=s1+"ay";
                System.out.println("The pig latin form of the word: \'"+s+"\' is: \'"+s1+"\'");
            }
        }