← Back to archive

Stdle #159 · strings · 2026-11-12

What does this C++ snippet output?

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

#include <iostream>
#include <string>
int main() {
std::string s = "abc";
std::string t = s;
t[0] = 'Z';
std::cout << s << " " << t << "\n";
}
Strings
4 attempts left

Answer & explanation