当前位置:网站首页>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
边栏推荐
- fatal error: torch/extension.h: No such file or directory
- Multitimer V2 reconstruction version | an infinitely scalable software timer
- Mysql database explanation (IX)
- c语言---指针进阶
- php函数
- JVM-第2章-类加载子系统(Class Loader Subsystem)
- IronPDF for .NET 2022.4.5455
- Redis主从复制过程
- Connect PHP to MSSQL via PDO ODBC
- Recommended search common evaluation indicators
猜你喜欢

WPS品牌再升级专注国内,另两款国产软件低调出国门,却遭禁令

Why disable foreign key constraints

Recommended search common evaluation indicators

使用 Bitnami PostgreSQL Docker 镜像快速设置流复制集群

Neodynamic Barcode Professional for WPF V11.0

JVM-第2章-类加载子系统(Class Loader Subsystem)

Mysql database explanation (VII)

Configuration of multi spanning tree MSTP

Detailed explanation of redirection and request forwarding

网站建设与管理的基本概念
随机推荐
Deeply learn the skills of parameter adjustment
IronPDF for .NET 2022.4.5455
字节面试 transformer相关问题 整理复盘
Openstack theoretical knowledge
怎么看基金是不是reits,通过银行购买基金安全吗
Mobile finance (for personal use)
网站压测工具Apache-ab,webbench,Apache-Jemeter
What if the package cannot be found
码住收藏▏软件测试报告模板范文来了
fatal error: torch/extension. h: No such file or directory
编译,连接 -- 笔记
Sorting and replying to questions related to transformer
PHP classes and objects
删除字符串中出现次数最少的字符
regular expression
移动app软件测试工具有哪些?第三方软件测评小编分享
Rsync + inotify remote synchronization
单体架构系统重新架构
服务器中毒了怎么办?服务器怎么防止病毒入侵?
携号转网最大赢家是中国电信,为何人们嫌弃中国移动和中国联通?