题解 | #计算某字符出现次数#

计算某字符出现次数

http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1

import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str =sc.nextLine().toLowerCase();//都变成小写 String s = sc.nextLine().toLowerCase(); int l = str.length(); l=l-str.replaceAll(s,"").length();//用代替的方式删除所有要计数的字符
System.out.println(l); } }

全部评论

相关推荐

明天不下雨了:这个项目 这个简历 这个模板 莫不是一个开源的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务