import java.lang.*;
/**
* 1、查找“asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd”
*该字符串中有多少个af replace(" "," ") :字符替换
* @author Administrator
*
*/
public class homework1 {
public static void main(String[] args) {
String str1 = "asdfjvjadsffvaadfkfasaffdsasdffadsafafsafdadsfaafd";
CharSequence cs1 = "af";
// string contains the specified sequence of char values
boolean retval = str1.contains(cs1);
System.out.println("Method returns : " + retval);
String str2 = "";
boolean flag = true;
while(flag == true){
str2 = str1.replace("af","");
flag = "af".contains(str1);
}
int length = str1.length() - str2.length();
System.out.println(length / 2);
}