A recursive function is defined to take a string as a parameter and return the number of characters that are not exclamation points. It recursively calls itself, passing a substring of the original starting from the next character each time, until the base case of a string with one character is reached. It returns 1 if the character is not an exclamation point, or 0 if it is, accumulating the counts back up the recursive calls to get the total length without exclamation points.