1、题目描述

2、题目分析
具体思路如下:
 预先定义String result = ""作为输出结果
 1、遍历str2字符串中的每个字符,将其存储到HashMap中(其中key为单个字符,value为该字符出现的次数)
 2、遍历str1字符串中的每个字符,str1与hashmap进行比较,通过hashmap.get(字符x)如果返回的value为null,
 则将此字符串加入到result输出结果中
 3、输出result
3、详细代码实现
public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String str1 = scanner.nextLine();
		String str2 = scanner.nextLine();
		String result = "";
		Map<Character, Integer> map = new HashMap<>();
		for (int i = 0; i < str2.length(); i++) {
			if (map.get(str2.charAt(i)) == null) {
				map.put(str2.charAt(i), 1);
			} else {
				map.put(str2.charAt(i), map.get(str2.charAt(i)) + 1);
			}
		}
		for (int i = 0; i < str1.length(); i++) {
			if (map.get(str1.charAt(i)) == null) {
				result += str1.charAt(i);
			}
		}
		System.out.println(result);
	}














![自动化测试框架[各自动化测试框架大比拼]](https://img-blog.csdnimg.cn/c1bd917590ac43c99f5af056ebd603e8.png)




