当前位置:网站首页>Deletes the least frequently occurring character in the string
Deletes the least frequently occurring character in the string
2022-04-23 15:40:00 【Ye Ningxia Xin】
describe
Delete the least frequent character in the string , If there are multiple characters with the least number of occurrences , Then delete the characters that appear the least . Output the string after deleting these words , The other characters in the string remain in the same order .
Data range : The length of the input string meets the requirements 1 \le n \le 20 \1≤n≤20 , Ensure that only lowercase letters appear in the input string
Input description :
String contains only lowercase letters , Illegal input is not considered , The length of the input string is less than or equal to 20 Bytes .
Output description :
Delete the string after the least frequent character in the string .
Example 1
Input :aabcddd
Output :aaddd
while True:
try:
s = input()
m = s.lower()
dic, res = {}, ''
if 1 <= len(m) <= 20:
for i in m:
if i not in dic:
dic[i] = 1
else:
dic[i] += 1
Min = min(dic.values())
for i in m:
if dic[i] != Min:
res += i
print(res)
except:
break
版权声明
本文为[Ye Ningxia Xin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231534071384.html
边栏推荐
猜你喜欢

服务器中毒了怎么办?服务器怎么防止病毒入侵?

Single architecture system re architecture

电脑怎么重装系统后显示器没有信号了

Openstack command operation

Timing model: gated cyclic unit network (Gru)

ICE -- 源码分析

木木一路走好呀

Demonstration meeting on startup and implementation scheme of swarm intelligence autonomous operation smart farm project

Sorting and replying to questions related to transformer

2022年中国数字科技专题分析
随机推荐
PHP PDO ODBC loads files from one folder into the blob column of MySQL database and downloads the blob column to another folder
Connect PHP to MSSQL via PDO ODBC
Cookie&Session
Pytorch中named_parameters、named_children、named_modules函数
布隆过滤器在亿级流量电商系统的应用
推荐搜索 常用评价指标
How to test mobile app?
Advantages, disadvantages and selection of activation function
大厂技术实现 | 行业解决方案系列教程
IronPDF for .NET 2022.4.5455
提取不重复的整数
Multi level cache usage
How did the computer reinstall the system? The display has no signal
fatal error: torch/extension.h: No such file or directory
Recommended search common evaluation indicators
通過 PDO ODBC 將 PHP 連接到 MySQL
移动app软件测试工具有哪些?第三方软件测评小编分享
Machine learning - logistic regression
Today's sleep quality record 76 points
Node.js ODBC连接PostgreSQL