You are viewing a single comment's thread. Return to all comments →
int cmp(const void *pa, const void *pb) { char * const s1 = (char *)pa; char * const s2 = (char *)pb; return strcmp(*s1, *s2); }
int main() { int N = parse_int(ltrim(rtrim(readline()))); char name[20]; int idx =0; for (int N_itr = 0; N_itr < N; N_itr++) { char* first_multiple_input = split_string(rtrim(readline()));
char* firstName = *(first_multiple_input + 0); char* emailID = *(first_multiple_input + 1); if(strstr(emailID,"@gmail.com") !=NULL) { name[idx++] = firstName; } } qsort(name,idx,sizeof(char*),cmp); for(int i =0; i < idx; i++) { printf("%s\n",name[i]); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Day 28: RegEx, Patterns, and Intro to Databases
You are viewing a single comment's thread. Return to all comments →
int cmp(const void *pa, const void *pb) { char * const s1 = (char *)pa; char * const s2 = (char *)pb; return strcmp(*s1, *s2); }
int main() { int N = parse_int(ltrim(rtrim(readline()))); char name[20]; int idx =0; for (int N_itr = 0; N_itr < N; N_itr++) { char* first_multiple_input = split_string(rtrim(readline()));
}