After you input 'b' the standard input also has the newline character. The next time you scan for a character, it's automatically taken from the standard input. If you want to ignore these whitespace characters, add a space before your character token in your format string (everywhere). E.g.:
scanf(" %c", &i);
// ...
scanf(" %c", &j);