Following is attached the code that works accordingly as required. It reads in characters from standard input and outputs the number of times it sees an 'a' followed by the letter 'b'. All the description of program is given inside the code as comments.
The answer is <span>smallest not yet placed. </span><span>In each iteration, selection sort places smallest not yet placed element in the correct location. </span>