// ── CREATE ───────────────────────────────────────────────────────
string s = "hello";
 
// ── LENGTH ───────────────────────────────────────────────────────
s.size();                                // number of characters
 
// ── SEARCH / SUBSTRING ───────────────────────────────────────────
int pos = s.find("lo");                  // returns index (or -1 if not found)
string part = s.substr(1, 3);            // ⭐ start_idx, length/size
 
// ── ACCESS ───────────────────────────────────────────────────────
s[0];                                    // no bounds check
s.at(1);                                 // bounds checked
s.front();                               // first character
s.back();                                // last character
 
// ── MODIFY ───────────────────────────────────────────────────────
s += "!";
s.push_back('!');                        // add one char
s.pop_back();                            // remove last char
s.insert(0, "Say ");                     // insert at index
s.erase(0, 4);                           // remove substring
 
// ── ITERATE ──────────────────────────────────────────────────────
for (auto ch : s)
    cout << ch << " ";
 
// ── CHAR UTILS ───────────────────────────────────────────────────
tolower(ch);                             // convert to lowercase (e.g. 'A' -> 'a')
toupper(ch);                             // convert to uppercase (e.g. 'a' -> 'A')
isalpha(ch);                             // check if alphabet (e.g. isalpha('a') -> true)
isupper(ch);                             // check if uppercase (e.g. isupper('A') -> true)
islower(ch);                             // check if lowercase (e.g. islower('a') -> true)
 
// ── CONVERSIONS ──────────────────────────────────────────────────
int num = stoi(s);                       // String to int (e.g. "42" -> 42)
string s_num = to_string(num);           // int to String (e.g. 42 -> "42")
float num_float = stof(s);               // String to float (e.g. "3.14" -> 3.14)
 
int val = '4' - '0';                     // char digit to int: '4' -> 4
char d = 4 + '0';                        // int digit to char: 4 -> '4'
 
int idx = 'c' - 'a';                     // char to index (0-25) -> useful for frequency arrays (e.g. int arr[26])
 
// ── ASCII VALUES ─────────────────────────────────────────────────
// 'a' = 97  to  'z' = 122
// 'A' = 65  to  'Z' = 90
// '0' = 48  to  '9' = 57