-
Notifications
You must be signed in to change notification settings - Fork 0
/
flames_source.c
49 lines (45 loc) · 1.11 KB
/
flames_source.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdbool.h>
int common_letters(char* first_name, char* second_name)
{
int count=0;
for(int i=0;i<first_name[i]!='\0';i++)
{
for(int j=0;j<second_name[j]!='\0';j++)
{
if (first_name[i]==second_name[j])
{
second_name[j]='*';
first_name[i]='*';
count+=2;
break;
}
}
}
return count;
}
char* find_relation(int len,char* str)
{
int loop=5;
int start=0;
while (loop--)
{
int i=0;
while(true)
{
if(str[start]=='\0') { start=0; }
if (str[start]!='*')
{
i++;
}
if ( i==len)
{
str[start]='*';
start++;
break;
}
start++;
}
}
return str;
}