A string is a sequence of characters you can index, compare and mutate — and each character is secretly a small number.
1 A string is a sequence
word[0] is the first character — indexes run 0 to size() - 1, exactly like arrays.
2 std::string manages itself
It grows, knows its length and copies deeply. No manual memory, unlike C-style char arrays.
3 Characters are numbers
a is 97, b is 98 — so c - a gives 0..25, the trick behind ciphers and letter counting.
4 The char toolkit
isalpha, isdigit, tolower and toupper classify and reshape one character at a time.
5 Two-pointer walks
lo at the start, hi at the end, walking inward — the palindrome pattern below.
Meet the chars
A string is a sequence1word[0] is the first character — indexes run 0 to size() - 1, exactly like arrays. std::string manages itself2It grows, knows its length and copies deeply. No manual memory, unlike C-style char arrays. Characters are numbers3a is 97, b is 98 — so c - a gives 0..25, the trick behind ciphers and letter counting. The char toolkit4isalpha, isdigit, tolower and toupper classify and reshape one character at a time. Two-pointer walks5lo at the start, hi at the end, walking inward — the palindrome pattern below. 5 building blocks make up Meet the chars
malayalam — 9 letters. lo and hi walk inward and compare one mirror pair at a time.
1 / 11malayalam — 9 letters. lo starts at index 0, hi at index 8; both walk inward.
Two pointers, one comparison per iteration — the whole check fits in five boxes.
process decision input / output start / end A vowel counter first, then a Caesar cipher with the % 26 wraparound.
mainword = "top" — three characters to classify.
Console
output appears as the program runs…
zyx shifts by 3 — every letter wraps through the % 26 gate and lands on cab.
1 / 11zyx shifts by 3 to become cab. Formula per letter: ((c - a) + 3) % 26 + a.
A string copy, one edit through the copy — does the original flinch?
Your predicted output — one line per console line
Hint: string t = s makes a deep copy. Editing t cannot touch s.
Click a term, then click its meaning to lock the pair.
8 conceptsTap a card to expand ?s[0]drops into place
?size() / length()drops into place
?palindromedrops into place
?substr(1, 3)drops into place
?s == tdrops into place
?c - 'a'drops into place
?tolowerdrops into place
?copy independencedrops into place
01Strings index from 0; the last valid index is size() - 1.
02std::string copies deeply — editing a copy leaves the original intact.
03Characters are small integers: c - a maps letters to 0..25.
04Shift ciphers wrap with % 26 so z rolls around to c.
05Two pointers (lo, hi) walking inward check palindromes in one pass.
06size() and length() are the same function with two names.