← Back to archive

Stdle #109 · containers · 2026-09-23

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
#include <unordered_map>
int main() {
std::unordered_map<std::string,int> m;
m["x"] = 5;
m["x"] += 3;
std::cout << m["x"] << " " << m.size() << "\n";
}
Containers
4 attempts left

Answer & explanation