当前位置:网站首页>【刷题】字符统计【0】
【刷题】字符统计【0】
2022-07-01 07:58:00 【司六米希】
一、题目
1.题目描述
题目:给出一个字符集合,请你判断出现的不同字符个数
输入:输入一行,长度在1000以内仅包括小写字母、‘{’、‘}’ 和空格
输出:输出一行,表示出现的不同字母个数
示例 :
二、解题报告
1.思路分析
- 1.首先将空格取代掉
- 2.排除{},干扰
- 3.计数
2.代码详解
python
a=input()
while(a.find(" ")>0):
a=a.replace(" ","")
b=list(a)
c=[]
d=[',','{','}',]
# print(b)
for i in range(len(b)):
if b[i]!=d[0] and b[i]!=d[1] and b[i]!=d[2]:
c.append(b[i])
# print(c)
e={
}.fromkeys(c).keys()
print(len(e))
边栏推荐
- 三极管是一项伟大的发明
- 【mysql学习笔记26】视图
- Instead of houses, another kind of capital in China is rising
- Contenttype comparison of all types
- 【入门】取近似值
- Why some people earn nearly 10billion a year, while others earn 3000 a month: the details you ignore actually make the most money
- SharePoint - modify web application authentication using PowerShell
- Wang Yingqi, founder of ones, talks to fortune (Chinese version): is there any excellent software in China?
- php laravel微信支付
- The Windows C disk is full
猜你喜欢

PWN attack and defense world int_ overflow

【入门】输入n个整数,输出其中最小的k个

Erreur de hauteur du clavier souple
![[getting started] intercepting strings](/img/16/363baa4982408f55493057200bcba5.png)
[getting started] intercepting strings

Why some people earn nearly 10billion a year, while others earn 3000 a month: the details you ignore actually make the most money

软键盘高度报错

Significance and measures of source code encryption

Android screen adaptation (using constraintlayout), kotlin array sorting
![[introduction] approximate value](/img/6b/597178d848dd21110f36601fc31092.png)
[introduction] approximate value

Differential: definition of total differential, partial derivative, gradient
随机推荐
[MySQL learning notes27] stored procedure
【入门】输入整型数组和排序标识,对其元素按照升序或降序进行排序
go通用动态重试机制解决方案的实现与封装
Aardio - 阴影渐变文字
SQL number injection and character injection
sqlalchemy创建MySQL_Table
2022 test question bank and simulation test of tea master (primary) operation certificate
How outlook puts together messages with the same discussion
Discussion on several research hotspots of cvpr2022
下载Xshell和Xftp
Latex table
Lm08 mesh series mesh inversion (fine)
【mysql学习笔记27】存储过程
Saving db4i depth camera pictures with MATLAB
ContentType所有类型对比
LM08丨网格系列之网格反转(精)
【入门】输入n个整数,输出其中最小的k个
力扣每日一题-第32天-1822.数组元素积的符号
IMDB practice of emotion classification (simplernn, LSTM, Gru)
Two expressions of string


