Piglatin form: Any word is converted into piglatin form by starting the word from the first vowel and adding the remaining part in the end followed by “AY”
import java.io.*;
class piglatin
{
public static void main(String args[])throws Exception
{
String a;
char c;int i,l;
System.out.println("Enter a word");
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
a=br.readLine();
l=a.length();
for(i=0;i<l;i++)
{ c=a.charAt(i);
if(c=='a' | c=='e' | c=='i' | c=='o' | c=='u')
break;
}
a=a.substring(i,l)+a.substring(0,i)+"AY"; // converting a word to Piglatin form
System.out.println("Pig Latin form for the word is: "+a);
}
}
No comments:
Post a Comment