有大佬可以帮我看一下代码吗 第二题 public class dechar { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String st=sc.nextLine(); HashSet<Character> hash=new HashSet<>(); int i=0; ArrayList arr=new ArrayList(); while (i<st.length()){ char c=st.charAt(i); if(!hash.contains(c)||c==' '){ hash.add(c); arr.add(c); i++; }else{ i++; } } for(Object ch:arr){ System.out.print(ch); } } }
点赞 评论

相关推荐

面了100年面试不知...:今年白菜这么多,冬天可以狂吃了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务