import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 创建Map集合
        Map<Integer, String> map = new HashMap<>();
        map.put(1, "Amy");
        map.put(2, "Joe");
        map.put(3, "Tom");
        map.put(4, "Susan");

        // 遍历并打印原始Map
        for (Map.Entry<Integer, String> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }
        System.out.println();

        // 2. 向Map中插入新的信息
        Scanner scanner = new Scanner(System.in);
        String newName = scanner.nextLine();
        map.put(5, newName);

        // 3. 移除编号为4的信息
        map.remove(4);

        // 4. 修改编号为3的姓名信息
        map.put(3, "Tommy");

        // 再次遍历并打印更新后的Map
        for (Map.Entry<Integer, String> entry : map.entrySet()) {
            System.out.println(entry.getKey() + ":" + entry.getValue());
        }
    }
}