Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define MAX 10001
- int main(void)
- {
- int n;
- scanf("%d",&n);
- getchar();
- char cadena[MAX];
- int i;
- for (i = 0 ; i < n ; i++) {
- scanf("%10001[^\n]s",cadena);
- getchar();
- int contador = 0;
- char *puntero;
- puntero = cadena;
- while ( (puntero = strstr(puntero,"heavy")) != NULL ) {
- char *puntero2;
- puntero2 = puntero + 5;
- while ( (puntero2 = strstr(puntero2,"metal") ) != NULL ) {
- contador++;
- puntero2= puntero2 + 5;
- }
- puntero = puntero + 5;
- }
- printf("cadenas poderosas = %d\n",contador);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment