subroutine count_words(cadena,n) C C Counts the number of words separated by blanks in a string C character*1000 cadena character*1 a,b n=0 a=cadena(1:1) if (a.ne.' ') n=1 do i=2,len(cadena) b=cadena(i:i) if(b.ne.' '.and.a.eq.' ') n=n+1 a=b enddo end