#include <stdio.h>
#include <string.h>
int contem(char s1[], char s2[]) {
int j;
for (int i = 0; s2[i]; i++) {
for (j = 0; s1[j]; j++) {
if(s2[i] == s1[j]) {
break;
}
}
if (s1[j] == '\0') {
return 0;
}
}
return 1;
}
int main() {
char s[] = "abc";
char v[] = "cdeabf";
if(contem(v, s)) {
printf("'%s' contém todos os caracteres presentes em '%s'", v
, s
); } else {
printf("'%s' não contém todos os caracteres presentes em '%s'", v
, s
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmludCBjb250ZW0oY2hhciBzMVtdLCBjaGFyIHMyW10pIHsKICAgIGludCBqOwogICAgZm9yIChpbnQgaSA9IDA7IHMyW2ldOyBpKyspIHsKICAgICAgICBmb3IgKGogPSAwOyBzMVtqXTsgaisrKSB7CiAgICAgICAgICAgIGlmKHMyW2ldID09IHMxW2pdKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZiAoczFbal0gPT0gJ1wwJykgewogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gMTsKfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIHNbXSA9ICJhYmMiOwogICAgY2hhciB2W10gPSAiY2RlYWJmIjsKICAgICBpZihjb250ZW0odiwgcykpIHsKICAgICAgICBwcmludGYoIiclcycgY29udMOpbSB0b2RvcyBvcyBjYXJhY3RlcmVzIHByZXNlbnRlcyBlbSAnJXMnIiwgdiwgcyk7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiJyVzJyBuw6NvIGNvbnTDqW0gdG9kb3Mgb3MgY2FyYWN0ZXJlcyBwcmVzZW50ZXMgZW0gJyVzJyIsIHYsIHMpOwogICAgfQogICAgcmV0dXJuIDA7Cn0=