public class GuessingGame{
public static void main(String[]args)throws Exception{
String a="Plan with us";
String b="p**n w*t* u*";
System.out.println(b);
while(b.indexOf('*')!=-1)
{
char e;
e=(char)System.in.read();System.in.read();System.in.read();
int position=a.indexOf(e);
if (position==-1)
{
System.out.println("Try Again");
}
else
{
b=b.substring(0,position)+e+b.substring(position+1,b.length());
System.out.println(b);
}
}
}
}
public static void main(String[]args)throws Exception{
String a="Plan with us";
String b="p**n w*t* u*";
System.out.println(b);
while(b.indexOf('*')!=-1)
{
char e;
e=(char)System.in.read();System.in.read();System.in.read();
int position=a.indexOf(e);
if (position==-1)
{
System.out.println("Try Again");
}
else
{
b=b.substring(0,position)+e+b.substring(position+1,b.length());
System.out.println(b);
}
}
}
}

thanks xa codes...
ReplyDeletemkatabang kau...
hahaha ure welcome!!haha
Delete