题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
using System; using System.Collections.Generic;//使用List需要使用 using System.Text;//使用StringBulider需要使用 namespace HJ9{ class Solution{ public static void Main(){ var res = new StringBuilder(); var str = Console.ReadLine().ToCharArray(); var len = str.Length; var map = new List<char>(); for(int i = len-1; i >= 0; i--){ if(!map.Contains(str[i])){//判断是否重复 map.Add(str[i]); res.Append(str[i]); } } Console.WriteLine(res); } } }