题解 | #提取不重复的整数#

提取不重复的整数

https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1

import sys


"""
2024年3月14日14:45:08 解法思路
1、输入字符串、变成列表
2、去重、反向输出
"""
str =  input()
strList =[]
for i in str:
    i = int(i)
    strList.append(i)
# set函数内部用的哈希表,有时候会自动排序
strList2 = []
for i in strList[::-1]:
    if i not in strList2:
        strList2.append(i)

for i in strList2:
    print(i,end='')



全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务