当前位置:网站首页>Calculate the number of occurrences of a character
Calculate the number of occurrences of a character
2022-04-23 15:40:00 【Ye Ningxia Xin】
describe
Write a program , Accept a letter from 、 A string of numbers and spaces , And a character , Then output the number of occurrences of the character in the input string .( Case insensitive )
Data range : 1 \le n \le 1000 \1≤n≤1000
Input description :
On the first line, enter a string of letters and numbers and spaces , Enter a character on the second line .
Output description :
The number of characters in the output input string .( Case insensitive )
Example 1
Input :ABCabc A
Output :2
Their thinking : loop
content = input()
content1 = content.upper()
ch = input()
ch1 = ch.upper()
num = 0
for i in content1:
if i == ch1:
num += 1
print(num)
notes :b = list(a.lower()) # Convert all input characters to lowercase letters
b = list(a.upper()) # Convert all input characters to uppercase letters
版权声明
本文为[Ye Ningxia Xin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231534071671.html
边栏推荐
- Upgrade MySQL 5.1 to 5.611
- 自主作业智慧农场创新论坛
- 大型互联网为什么禁止ip直连
- MySQL集群模式與應用場景
- utils.DeprecatedIn35 因升级可能取消,该如何办
- 【Leetcode-每日一题】安装栅栏
- 一刷314-剑指 Offer 09. 用两个栈实现队列(e)
- Code live collection ▏ software test report template Fan Wen is here
- 多生成树MSTP的配置
- What are the mobile app software testing tools? Sharing of third-party software evaluation
猜你喜欢
随机推荐
fatal error: torch/extension.h: No such file or directory
网站压测工具Apache-ab,webbench,Apache-Jemeter
大型互联网为什么禁止ip直连
现在做自媒体能赚钱吗?看完这篇文章你就明白了
Explanation of redis database (IV) master-slave replication, sentinel and cluster
GFS distributed file system (Theory)
Educational codeforces round 127 A-E problem solution
Special analysis of China's digital technology in 2022
如果conda找不到想要安装的库怎么办PackagesNotFoundError: The following packages are not available from current
Upgrade MySQL 5.1 to 5.67
s16.基于镜像仓库一键安装containerd脚本
Connect PHP to MSSQL via PDO ODBC
网站建设与管理的基本概念
utils.DeprecatedIn35 因升级可能取消,该如何办
Explanation 2 of redis database (redis high availability, persistence and performance management)
Multitimer V2 reconstruction version | an infinitely scalable software timer
计算某字符出现次数
WPS品牌再升级专注国内,另两款国产软件低调出国门,却遭禁令
cadence SPB17. 4 - Active Class and Subclass
Upgrade MySQL 5.1 to 5.69









