当前位置:网站首页>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
边栏推荐
- 为啥禁用外键约束
- Mysql database explanation (10)
- Deep learning - Super parameter setting
- MySQL Cluster Mode and application scenario
- 电脑怎么重装系统后显示器没有信号了
- What role does the software performance test report play? How much is the third-party test report charged?
- 【AI周报】英伟达用AI设计芯片;不完美的Transformer要克服自注意力的理论缺陷
- 如果conda找不到想要安装的库怎么办PackagesNotFoundError: The following packages are not available from current
- Explanation of redis database (I)
- 自动化测试框架常见类型▏自动化测试就交给软件测评机构
猜你喜欢

Machine learning - logistic regression

Codejock Suite Pro v20.3.0

携号转网最大赢家是中国电信,为何人们嫌弃中国移动和中国联通?

Recommended search common evaluation indicators

Openstack theoretical knowledge

MultiTimer v2 重构版本 | 一款可无限扩展的软件定时器

Why disable foreign key constraints

激活函数的优缺点和选择

MySQL Cluster Mode and application scenario

Detailed explanation of redirection and request forwarding
随机推荐
Explanation 2 of redis database (redis high availability, persistence and performance management)
Sorting and replying to questions related to transformer
Advantages, disadvantages and selection of activation function
Introduction to dynamic programming of leetcode learning plan day3 (198213740)
2022年中国数字科技专题分析
php函数
网站压测工具Apache-ab,webbench,Apache-Jemeter
pgpool-II 4.3 中文手册 - 入门教程
单体架构系统重新架构
Codejock Suite Pro v20. three
T2 icloud calendar cannot be synchronized
自动化测试框架常见类型▏自动化测试就交给软件测评机构
字符串最后一个单词的长度
一刷314-剑指 Offer 09. 用两个栈实现队列(e)
导入地址表分析(根据库文件名求出:导入函数数量、函数序号、函数名称)
【AI周报】英伟达用AI设计芯片;不完美的Transformer要克服自注意力的理论缺陷
推荐搜索 常用评价指标
Explanation of redis database (IV) master-slave replication, sentinel and cluster
Cookie&Session
Redis master-slave replication process