#include <unistd.h>
int check_doubles(char *str, char c, int pos)
{
int i;
i = 0;
while (i < pos)
{
if (str[i] == c)
return (0);
i++;
}
return (1);
}
void inter(char *s1, char *s2)
{
int i;
int j;
i = 0;
while (s1[i])
{
j = 0;
while (s2[j])
{
if (s1[i] == s2[j])
{
if (check_doubles(s1, s2[i], i) == 1)
{
write(1, &s1[i], 1);
break;
}
}
j++;
}
i++;
}
}
int main(int ac, char **av)
{
if (ac == 3)
inter(av[1], av[2]);
write(1, "\n", 1);
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: