implicit none integer::N,i character,allocatable::L(:) integer::total(6),max,indx character*16::cformat='(a, (1x,a))' data total/6*0/ read *,N allocate(L(N-1)) write(cformat(4:8),'(i5)'),N-1 read cformat,L do i=1,N-1 indx = ICHAR(L(i))-ICHAR('0') total(indx) = total(indx) + 1 end do max = MAXVAL(total) do i=6,1,-1 if(max.eq.total(i)) then print '(i0)', i return end if end do end program