一、测试程序:
1 /*
2 * 最长上升子串长度
3 *
4 */
5
6 #include <stdio.h>
7 #include <string.h>
8
9 #define MAX(a, b) (a)>(b) ? (a):(b)
10
11 int main()
12 {
13 unsigned char str[1024] = {0};
14
15 while (~scanf("%s", str)) {
16 int cnt = 1;
17 int len = 0;
18 int max = 0;
19 int i = 0;
20
21 len = strlen(str);
22 for (; i<len-1; i++) {
23 if (str[i+1] > str[i])
24 cnt++;
25 else
26 cnt = 1;
27
28 max = MAX(max, cnt);
29 }
30
31 printf("%d
", max);
32 }
33
34 return 0;
35 }