package ch11;
import java.util.Scanner;
/**
* Created by liwenj on 2017/7/21.
*/
public class T6 {
public static void main(String[] args) {
String w = "我爱你中国,我爱你故乡";
String a = "爱";
int k=0;
for (int i=0;i<w.length();i++){
String tp=w.substring(i,i+1);
System.out.println(tp);
if(tp.equals(a)){
k++;
}
}
System.out.println(a+"出现的次数是"+k);
}
}