//str为字符串,ch为指定字符,返回出现的次数
public static int count(String str,char ch){
int count = 0;
for(int i=0;i
}
return count;
}
import java.io.*;
class text
{
static BufferedReader keyboard=new
BufferedReader(new InputStreamReader(System.in));
public static void main(String[]args)throws IOException
{
char ch='n';//指定字符
String InputString;
int count=0;
System.out.print("请输入一段字符串:");
InputString=keyboard.readLine();
for(int i=0;i
count++;
System.out.println(count);
}
}