Solução: Problema da competição alien (Tito Filho)

From AdonaiMedrado.Pro.Br
Revision as of 18:01, 3 April 2009 by 200.17.147.2 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#include <stdio.h>
#include <string.h>
 
int main (void)
{
   char frase[251];
   int i,N,x,soma;
   scanf("%d",&N);
   if (N>=1 && N<=10)
   {	
     	scanf("%s", frase);
     	i=0; soma=0;
     	while (frase[i]!='\0')
     	{
     		x=0;
  		while(frase[i]>='a' && frase[i]<='z')
  		{
  			x++;
  			i++;
		}
  		i++;  				
		if (x==N)
			++soma;
	}		
     	printf("%d",soma);
    }
}