当前位置:网站首页>Write a program, accept a string consisting of letters, numbers and spaces, and a character, and then output the number of characters in the input string. Case insensitive.
Write a program, accept a string consisting of letters, numbers and spaces, and a character, and then output the number of characters in the input string. Case insensitive.
2022-07-27 13:23:00 【Clear glaze in the wind】
Title Description
Write a program , Accept a string of letters and numbers and spaces , And a character , Then output the number of characters in the input string . Case insensitive .
Input description :
Enter a string of letters and numbers and spaces , And a character .
Output description :
The number of characters in the output input string .
Example 1
Input
Copy
ABCDEF A
Output
Copy
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);
}
}
边栏推荐
- Optimization Practice of Flink OLAP job scheduling and query execution based on ByteDance
- POJ2594 Treasure Exploration【二分图最小路径覆盖】【Floyd】
- Initializing database error after reinstalling MySQL
- Final solution for high collapse (no side effects)
- W3school navigation bar exercise
- 文章复现:SRCNN
- Reptile
- 字节跳动的 Flink OLAP 作业调度和查询执行优化实践
- Feign client automatic assembly of three clients
- Sff1004-mhchxm diode sff1004
猜你喜欢

Amd adrenalin 22.7.1 driver update: double the performance of OpenGL and support Microsoft win11 22h2 system

附加:【URLEncoder.encode(待编码字符串, “编码方式“);】(是什么?;我们向cookie中设置值的时候,为什么要使用这个去编码?)(待完善……)

Why does the class annotated with @configuration generate cglib proxy?

AMD Adrenalin 22.7.1 驱动更新:OpenGL 性能翻倍,支持微软 Win11 22H2 系统

PAT乙级 1109 擅长C(详解)

Eccv2022 | Ru & Google proposed to use clip for zero shot target detection!

Musk was exposed to be the founder of Google: he broke up his best friend's second marriage and knelt down to beg for forgiveness

ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!

常见分布式理论(CAP、BASE)和一致性协议(Gosssip、Raft)

实现新增加硬盘的磁盘分区和文件系统挂载
随机推荐
Hierarchy of elements
Insert sort, positive order, reverse order
一款能模糊的地方都能模糊的测试工具——Wfuzz
赋能金融风控加分项的这30个问题,您都搞懂了吗
Build mtk6765 compilation environment
Amd adrenalin 22.7.1 driver update: double the performance of OpenGL and support Microsoft win11 22h2 system
图标字体
Icon Font
xshell7可以登录mysql虚拟机不能登陆mysql
最新版泛域名证书申请
Antd's tool function getprefixcls gets the public prefix
Seata 在蚂蚁国际银行业务的落地实践
SQL group by statement
Text style
From the perspective of it, the CIO of B2B industry talks about how to change from "cost center" to "growth center"?
Method of changing thread state
Feign's overall process
Do you really understand CMS garbage collector?
Fixed positioning
字节跳动的 Flink OLAP 作业调度和查询执行优化实践