#include <stdio.h>

const char *ft_strstr(const char *str, const char *to_find) {
    if (str[0] == 0 && to_find[0] == 0) return str;
    for (int i = 0; str[i]; i++) {
        int j;
        for (j = 0; to_find[j] && str[i + j] && to_find[j] == str[i + j]; j++);
        if (to_find[j] == 0) return &(str[i]);
    }
    return NULL;
}

int main(void) {
    printf("1: %s\n", ft_strstr("Testando", "st"));
    printf("2: %s\n", ft_strstr("O rato roeu a roupa do rei de Roma", "ro"));
    printf("3: %s\n", ft_strstr("Nao vai achar", "vai nada"));
    printf("4: %s\n", ft_strstr("Vai achar no fim", "fim"));
    printf("5: %s\n", ft_strstr("Logo no inicio vai ser encontrado", "Logo no inicio"));
    printf("6: %s\n", ft_strstr("Nao vai procurar nada", ""));
    printf("7: %s\n", ft_strstr("", "Vai procurar em lugar nenhum"));
    printf("8: %s\n", ft_strstr("", ""));
    return 0;
}