#include <stdio.h>
int testarString(char *fonte, char encontrar[]){
int i
, ret
= 0, tamanho
= strlen(encontrar
); while (*fonte){
for (i = 0; i < tamanho; i++)
ret += ((*fonte == encontrar[i]) ? 1: 0);
*fonte++;
}
return ((ret == tamanho) ? 0: 1);
}
int main(){
char v[] = "cdeabf";
char s[] = "abc";
if (testarString(v, s) == 0){
printf("Os caracteres da string %s aparecem em %s.\n", s
, v
); } else {
printf("Um determinado caractere da string %s nao foi encontrado em %s.\n", s
, v
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgdGVzdGFyU3RyaW5nKGNoYXIgKmZvbnRlLCBjaGFyIGVuY29udHJhcltdKXsKICAgIGludCBpLCByZXQgPSAwLCB0YW1hbmhvID0gc3RybGVuKGVuY29udHJhcik7CiAgICB3aGlsZSAoKmZvbnRlKXsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgdGFtYW5obzsgaSsrKQogICAgICAgICAgICByZXQgKz0gKCgqZm9udGUgPT0gZW5jb250cmFyW2ldKSA/IDE6IDApOwogICAgICAgICpmb250ZSsrOwogICAgfQogICAgcmV0dXJuICgocmV0ID09IHRhbWFuaG8pID8gMDogMSk7Cn0KCmludCBtYWluKCl7CiAgICBjaGFyIHZbXSA9ICJjZGVhYmYiOwogICAgY2hhciBzW10gPSAiYWJjIjsKICAgIGlmICh0ZXN0YXJTdHJpbmcodiwgcykgPT0gMCl7CiAgICAgICAgcHJpbnRmKCJPcyBjYXJhY3RlcmVzIGRhIHN0cmluZyAlcyBhcGFyZWNlbSBlbSAlcy5cbiIsIHMsIHYpOwogICAgfSBlbHNlIHsKICAgICAgICBwcmludGYoIlVtIGRldGVybWluYWRvIGNhcmFjdGVyZSBkYSBzdHJpbmcgJXMgbmFvIGZvaSBlbmNvbnRyYWRvIGVtICVzLlxuIiwgcywgdik7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==