summaryrefslogtreecommitdiff
path: root/web/funnelAC/answers/hi10.out
blob: a7ec61c0f652eb69d673817c7e642cf3ef365891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

/* Pre: sorted(b). */
i=1; p=1;
while (i != N)
  {
   /* Invariant: sorted(b) and 1<=i<=N and           */
   /*            p is len of longest run in b[1..i]. */
   i++; if (b[i] != b[i-p]) p++;
  }
/* Post: sorted(b) and p is the length of the longest run in b[1..N]. */


bool comp(p,q)
char *p,*q;
{
 while (TRUE)
   {
    if (*p != *q  ) return FALSE;
    if (*p == '\0') return TRUE;
    p++; q++;
   }
}