``` Input: A string of "a", "b" and "c". Output: Return true if the input contains exactly three letters. Otherwise, return false. Constraint: 1 <= Input length <= 7 Challenge: At most 5 lines. (Complete) Example: Input: abc Output: true Input: ab Output: false Input: abab Output: false ``` ### My Solution(s): ### ``` aaaa=(return)false b=a c=a aaa=(return)true =(return)false ``` ``` aaaa=(return)false b=a c=a aaa=(return)true a=aaaa ``` **Explanation:** The approach is to reduce everything to a single character and use a clever counting condition. First, if `string` has at least 4 consecutive `a`'s, then the input string has more than 3 characters. So, line 4 runs $\iff$ `string` consists of only `a` and the number of characters is $\leq$ 3. Of course, if the `string` originally had 3 characters, it still does and they are now all `a` so line 4 terminates the program returning `string` with value `true` as desired. Otherwise, `string` originally had $\leq$ 2 characters and so we return false. In the second program, we simply add a bunch of `a`s to this string of $\leq$ 2 characters so that the first conditional on line 1 triggers the program to return `string` with value `false`.