import java.util.*;
class FindString
{
public static void main(String arg[])
{
Scanner ob=new Scanner(System.in);
String st="I am a student, you're also a .";
String search;
String st2="";
String st3="";
int i,c=0;
System.out.println(st);
System.out.println("Enter your word to search: ");
search=ob.next();
do
{
i=st.indexOf(search);
if(i!=-1)
{
st2=st.substring(0,i);
st2+=st3;
st2+=st.substring(i+search.length());
c=c+1;
st=st2;
}
}while(i!=-1);
System.out.println("Found=" + c);
}
}
Sorry for all friends, that i could use the bb tag code. Wish you all feel me .