标签:
3 aaa ababc abklmncdefg
1 3 7
#include<cstdio> #define N 10001 int main() { int dp[N]; char s[N]; int t; scanf("%d", &t); while (t--) { int ans = 0; scanf("%s", s); for (int i = 0; s[i] != '\0'; i++) { dp[i] = 1; for (int j = 0; j < i; j++) { if (s[i]>s[j] && dp[i] < dp[j] + 1) { dp[i] = dp[j] + 1; } } if (ans < dp[i]) ans = dp[i]; } printf("%d\n", ans); } return 0; }
标签:
原文地址:http://blog.csdn.net/qq_24489717/article/details/45439495