当前位置:网站首页>写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。
写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。
2022-07-27 12:48:00 【风间净琉璃】
题目描述
写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。
输入描述:
输入一个有字母和数字以及空格组成的字符串,和一个字符。
输出描述:
输出输入字符串中含有该字符的个数。
示例1
输入
复制
ABCDEF A
输出
复制
1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String inputStr = scanner.nextLine();
String nextLine = scanner.nextLine();
String[] inputArray = inputStr.split("");
int sum=0;
for(String s:inputArray){
if(nextLine.equalsIgnoreCase(s)){
sum++;
}
}
System.out.println(sum);
}
}
边栏推荐
- Poj1548 robots [bipartite graph minimum path coverage]
- Poj2446 chessboard [maximum matching of bipartite graph]
- SSM practical project - front back separation (easy to understand)
- Background and framework introduction and basic environment preparation of hucang integrated e-commerce project
- Poj1273 drainage ditches [maximum flow] [SAP]
- heap
- POJ1548 Robots【二分图最小路径覆盖】
- JS true / false array conversion
- Finally, I was ranked first in the content ranking in the professional field. I haven't been tired in vain during this period. Thanks to CSDN's official platform, I'm lucky and bitter.
- 【萌新解题】斐波那契数列
猜你喜欢

From the perspective of it, the CIO of B2B industry talks about how to change from "cost center" to "growth center"?

Top 10 international NFT exchanges

multi-table query

Dominoes staged: the beginning and end of the three arrow capital crash

500强企业如何提升研发效能?来看看行业专家怎么说!

详述HashSet的add方法

CVPR22 | 关系意识的图神经架构搜索

Finally, I was ranked first in the content ranking in the professional field. I haven't been tired in vain during this period. Thanks to CSDN's official platform, I'm lucky and bitter.

js真伪数组转换

Error: slf4j: class path contains multiple slf4j bindings
随机推荐
程序员培训学习后好找工作吗
爱可可AI前沿推介(7.27)
js日期时间格式化(年月日、时分秒、星期、季度、获取时间差、日期与时间戳转换的功能)
CEPH distributed storage performance tuning (6)
Optimization Practice of Flink OLAP job scheduling and query execution based on ByteDance
How to get class objects
Is it easy to find a job after programmer training and learning
GAN:生成对抗网络 Generative Adversarial Networks
flinksql从Oracle同步数据到Doris,一共50几个字段,Oracle表中3000多万条
What are metauniverse and NFT digital collections?
关于2022年3月9日之后Typora登录不了--已解决
C program debugging and exception handling (try catch)
Flinksql synchronizes data from Oracle to Doris, with a total of more than 50 fields and more than 30 million entries in Oracle tables
Uniapp video video playback is not completed. It is forbidden to drag the progress bar fast forward
Getting started for beginners: build your own blog with WordPress
Dominoes staged: the beginning and end of the three arrow capital crash
Aike AI frontier promotion (7.27)
An overview of kernel compilation system
Interviewer: how to deal with the data loss of redis master-slave cluster switching?
一款能模糊的地方都能模糊的测试工具——Wfuzz