Skip to main content

Posts

Showing posts with the label piglatin

Piglatin

AJ Java Programs Program 7: Piglatin When in a word first character is moved to last and "ay" is added to it it becomes Piglatin Lets See how to do it. Syntax: import java.io.*; class  piglatin { public static void main(String args[])throws IOException {      char ch;    String word="",str="";    int i;    String s;    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    System.out.println("Enter a String");    s=br.readLine();    s=s.trim();    s=" "+s+" ";    for(i=1;i<s.length();i++)    {        ch=s.charAt(i);        if(ch!=' ')        word+=ch;        else if(s.charAt(i-1)!=' ')        {            StringBuffer sb=new StringBuffer(word); ...