You have to run a loop from 0 to len-1 and for each index check if (input[i] == 'n') then increment a count variable by one.