// Arup Guha
// 4/23/2024
// Solution to Spring 2024 COP 3503 Final Exam Question #1

import java.util.*;

public class q1 {

	public static void main(String[] args) {
	
		// Basic test.
		TreeSet<String> stuff = new TreeSet<String>();
		stuff.add("Quan");
		stuff.add("Alice");
		stuff.add("Fred");
		stuff.add("Jamal");
		TreeMap<String,Integer> map = getMap(stuff);
		
		// Print out mapping.
		for (String s: map.keySet())
			System.out.println(s+": "+map.get(s));
	}
	
	public static TreeMap<String,Integer> getMap(TreeSet<String> names) {
	
		// Create the map and start the id off at 0.
		TreeMap<String,Integer> map = new TreeMap<String,Integer>();
		int id = 0;
		
		// Pull names from the map in lexicographical order.
		while (names.size() > 0) {
			String name = names.pollFirst();
			
			// Map the id to this name and increment the id afterwards.
			map.put(name, id++);
		}
		
		// Ta da!
		return map;
	}
}