Introductory String Exercises

  1. Count characters in a string, solution (and some actual discussion) here.
  2. Counting duplicates in a string, solution (no discussion) here.
  3. Detect pangram is one question where it invites the idea of building a table (in this case, of all lowercase letters) “manually”. The idea of having your code use a big constant like that doesn’t come up too often in these questions. Solution here.
  4. A smaller version is counting vowels, solution here. Should start with that, I think.
  5. Capitalizing all the words in a sentence, as requested in this question, is a nice warm-up exercise. That particular description has some strange jokes about how it presents its task. Solution here.
  6. Run-length-encoding is neat because it also can introduce the concept, which is worth learning. More of an array question rather than a string question. Solution here.