题解 | #字符集合#

字符集合

http://www.nowcoder.com/questionTerminal/784efd40ed8e465a84821c8f3970b7b5

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()) {
        String str = scanner.nextLine();
        HashMap<Character, Integer> hashtable = new HashMap<Character,Integer>();
        for(int i = 0;i<str.length();i++) {
            if(!hashtable.containsKey(str.charAt(i))){
                System.out.print(str.charAt(i));
                hashtable.put(str.charAt(i),i);
            }
        }
            System.out.println();
    }
} 
}

哈希表yyds!

全部评论

相关推荐

后来123321:别着急,我学院本大二,投了1100份,两个面试,其中一个还是我去线下招聘会投的简历,有时候这东西也得看运气
无实习如何秋招上岸
点赞 评论 收藏
分享
投递长鑫存储等公司8个岗位
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务