Imagine the answer script of a written paper for Assistant Programmer. Question 3 says: write a C program to print the following pattern, and under it are three short lines of zeros and ones. Question 4 says: write a program to count how many times a given character appears in a string. At first sight the two questions have nothing in common. One draws a picture, the other reads a sentence. But look at the programs that answer them. Each is a loop, or a loop inside a loop, and the hard part is never the C. The hard part is deciding, before you write a single line, what exactly the loops must count.
In the last chapter you took a number apart digit by digit with % 10 and / 10. This chapter takes two other things apart: a picture, row by row, and a piece of text, character by character. Both are jobs for the same two or three loops you already know, and both reward the same habit, which is to work the answer out on paper first and let the code follow.
By the end you will be able to turn any pattern in a question into a small table and then into nested loops: letters, countdowns, checkerboards, number pyramids, diamonds, Floyd's and Pascal's triangles, and a pattern built from a number the user types. You will count anything in a string in one pass: one character, vowels and consonants, every letter at once, words. You will test anagrams and palindromes, reverse text in the ways exams ask, shift letters around the alphabet, and delete characters or a whole substring from a string without a second array. Every program here was compiled and run, and the output you see is the real output.
We go in four parts: how to read a pattern, the larger pictures, counting in strings, and working on a string from both ends.