int main(int argc, char **argv) { char src[512]; printf("Enter a string to find max non-repeat sub-string: "); scanf("%s", src);
printf("Index of max non-duplicated substring: %d\n", substring(src));
return 0; }
测试结果: Enter a string to find max non-repeat substring: abcdefaghijklabv max non-repeat substring length: 12 max non-repeat substring: bcdefaghijkl Index of max non-duplicated substring: 1
Enter a string to find max non-repeat substring: abcdefghijklmnopq
max non-repeat substring length: 17
max non-repeat substring: abcdefghijklmnopq
Index of max non-duplicated substring: 0