题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import sys str = str(input()) my_list = [] while len(str) > 0: if str[-1] not in my_list: my_list.append(str[-1]) str = str[:-1] else: str = str[:-1] result="" for s in my_list: result=result+s print(result)
1.将输入的整数转成字符
2.循环遍历当前字符串,取倒数第一个