	character*133 dis,err,f1*20
	character*1 c,co(99),mark(16)
	integer mag(16),mer(16)
	integer mmm(49999)
	if(iargc().lt.1)then
	  write(*,*)
	  write(*,*)'  usage: limerr file'
	  write(*,*)
	  write(*,*)'        output file1'	  
	  write(*,*)
	  stop
	endif
	call getarg(1,f1)
	open(1,file=f1,status='old')
	read(1,'(a)')dis
	nk=lnblnk(dis)
	write(2,'(a)')dis(1:nk)
        n16=16-(133-nk)/6
        nk=133-(16-n16)*6
	n=0
	kk=0
	m=0
10	read(1,'(a)',end=100)dis
	read(1,'(a)')err
	kk=kk+2
	if(dis(1:1).ne.' ')then
	  c=dis(1:1)
	  do 11 i=1,n
	  if(c.eq.co(i))goto 10
11	  continue
	  n=n+1
	  co(n)=c
	  goto 10
	endif
	do 13 i=1,n16
	read(dis(i*6+33:),'(i5)')mag(i)
13	read(err(i*6+33:),'(a1,1x,i3)')mark(i),mer(i)
	if(mag(1).gt.14000)goto 10
	j=0
	do 14 i=1,n16
14	if(mer(i).ne.0.or.mark(i).ne.' ')j=j+1
	if(j.ne.n16)then
	  m=m+1
	  mmm(m)=kk
	endif
	
	goto 10
100	close(1)
	write(*,'(99a2)')(co(i),i=1,n)
	write(*,'(12i6)')(mmm(i),i=1,m)
	end
