This problem taught you when maps beat sets: anytime you need to associate data with keys. Sets answer "is this present?" but maps answer "what value goes with this key?" Frequency counting and state tracking need maps.
I showed you the check-then-act pattern. You check if a key exists, then branch. If missing, initialize it. If present, use the value and update. This pattern appears constantly in map problems.
You learned that maps maintain state between iterations. Unlike arrays where you need indices, maps let you use meaningful keys like usernames. This makes your code more readable.