Saturday , 10 October 2015
Home » ICSE Important Programs » [Question 6] ICSE 2013 Paper Solved (Piglatin Word)

[Question 6] ICSE 2013 Paper Solved (Piglatin Word)


Write a program that encodes a word into Piglatin. To translate a word into a Piglatin word, convert the word into uppercase and then place the first vowel of the original word as the start of the new word along with the remaining alphabets. The alphabets present before the vowel being shifted towards the end followed by “AY”.
Sample Input (1) : London, Sample Output (1) : ONDONLAY
Sample Input (2) : Olympics, Sample Output (2) : OLYMPICSAY

Programming Code:

* The class Piglatin inputs a word and translates it into a Piglatin word
* @author :
* @Program Type : BlueJ Program - Java
* @Question Year : ICSE 2013 Question 6

class Piglatin
    public static void main(String args[])throws IOException
            BufferedReader br=new BufferedReader (new InputStreamReader(;
            System.out.print("Enter any word: ");
            String s=br.readLine();

            s=s.toUpperCase(); //converting the word into Uppercase
            int l=s.length();
            int pos=-1;
            char ch;

            for(int i=0; i<l; i++)
                if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
                    pos=i; //storing the index of the first vowel

            if(pos!=-1) //printing piglatin only if vowel exists
              String a=s.substring(pos); //extracting all alphabets in the word beginning from the 1st vowel
              String b=s.substring(0,pos); //extracting the alphabets present before the first vowel
              String pig=a+b+"AY"; //adding "AY" at the end of the extracted words after joining them
              System.out.println("The Piglatin of the word = "+pig);
              System.out.println("No vowel, hence piglatin not possible");


Enter any word: London
The Piglatin of the word = ONDONLAY
Enter any word: Olympics
The Piglatin of the word = OLYMPICSAY

Check Also

default thumbnail

Java program to arrange words in Ascending order of their Potential (ISC Specimen 2016 Question 2)

Java program to input a sentence and arrange the words in it in ascending order of their potential. Solution to Question 2 of ISC Computer Science Practical Specimen Paper 2016.

Leave a Reply

Your email address will not be published. Required fields are marked *