#include <stdio.h>
#include <string.h>
int endswith(const char* haystack, const char* needle) {
size_t haystacklen = strlen(haystack);
size_t needlelen = strlen(needle);
if (needlelen > haystacklen) return 0;
// end of haystack equals needle ?
return strcmp(&haystack[haystacklen - needlelen], needle) == 0;
}
int main() {
char s[] = "c c++ java python";
char tofind[] = "python";
if (endswith(s, tofind)) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
}
/*
run:
yes
*/