> # define MAX_LINE_LENGTH 100struct
{to; w;
} edge; a [N] [NE]; ne [N]; n = 0; v [N]; c; hash_table [P]; term [N] [M]; count; (char * s)
{long i, h1 = 0, h2 = 0; (i = 0; s [i]; i + +)
{* = 13; + = s [i]% 13; * = 17; + = s [i]% 17;
}% = P;% = P - 1; + +; (hash_table [h1]! = -1)
{(strcmp (term [hash_table [h1]], s) == 0) return hash_table [h1]; + = h2;% = P;
} _table [h1] = n; (term [n], s); n + +;
} (int root)
{i; [root] = c; (i = 0; i
} ()
{i, j, id1, id2, m; w; term1 [M]; term2 [M]; in [MAX_LINE_LENGTH]; (i = 0; i
{(sscanf (in, "% s% s", term1, term2) == 2)
{= getid (term1); = getid (term2); [id2] [ne [id2]]. to = id1; [id2] [ne [id2]]. w = w; [ id2] + +;
}
} = 0; (i = 0; i
{+ +; (i);
} 0;
}