This is actually a very good example for beginners. If teaches the concept of a boolean expression, of the conversion from bool to int, how the for loop works / the order it proceeds.
i == input is a boolean expression which means it evaluates to true or false. True and false are casted as integers to 1 and 0 respectively. So you are adding 1 if i == input is true, and 0 if not. This way, you keep asking for the same letter until the user enters the correct one.
== is a comparison operator. x == y, is a comparison that tests if what is on it's left and right side are equal to each other. This is evaluated to a type bool, true or false. In order to add bool to an int, the bool needs to be converted to an int. The rules are that true is converted as int to 1, and false is converted to 0. It is also important to note that when converting an int to bool, 0 is converted to false, and any other value is converted to true.