program countops
   implicit none
   character(*), parameter :: no = 'parameter'
   character(*), parameter :: yes = 'subroutine'
   character(132) line
   character array(132)
   integer nplus, nminus, ntimes
   character(10) name
   character(80) filename

   write(*,'(a)',advance='no') ' Enter the input file name:> '
   read(*,'(a)') filename
   open(10,file=filename,status='old')
   write(*,'(a)') '   Program  Adds  Muls'
   do
      read(10,'(a)',err=10,end=10) line
      if(index(line,yes) == 0) cycle
      nplus = 0
      ntimes = 0
      nminus = 0
      do
         read(10,'(a)',err=10,end=10) line
         if(index(line,yes) /= 0) exit
         if(index(line,no) /= 0) cycle
         array = transfer(line,array)
         nplus = nplus+count(array == '+')
         nminus = nminus+count(array == '-')
         ntimes = ntimes+count(array == '*')
      end do
      name = line(index(line,yes)+len(yes):)
      name = adjustr(name)
      write(*,'(a10,2i6)') name, nplus+nminus, ntimes
   end do
10 continue
end program countops

