We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<math.h>#include<stdio.h>#include<string.h>#include<stdlib.h>#include<assert.h>#include<limits.h>#include<stdbool.h>intmain(){intq,j=0;scanf("%d",&q);for(inta0=0;a0<q;a0++){j=0;char*s=(char*)malloc(512000*sizeof(char));scanf("%s",s);charref[]="hackerrank";// your code goes herefor(inti=0;i<strlen(s);i++){if(s[i]==ref[j])j++;}if(j==strlen(ref))printf("YES\n");elseprintf("NO\n");}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
HackerRank in a String!
You are viewing a single comment's thread. Return to all comments →
C solution