Task 7 is done

This commit is contained in:
AZEN-SGG 2025-05-21 12:31:06 +03:00
parent 6f21fa116f
commit 6ef0a8bfb3
17 changed files with 138 additions and 44 deletions

View file

@ -6,15 +6,21 @@
int t6_solve (node *head)
{
char *last = head->string;
int count = 1;
int count = 0, local = 0;
for (head = head->next; head; head = head->next)
{
if (strcmp(head->string, last))
count++;
if (strcmp(head->string, last) == 0)
local = 1;
else {
count += local;
local = 0;
}
last = head->string;
}
count += local;
return count;
}