DFS+字典树。
1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 typedef struct Trie { 6 int v; 7 Trie *next[26]; 8 } Trie; 9 10 Trie root; 11 int arr[11] = {0,0,0,3,6,9,12,15,19,22,26}; 12 char buf[105], tmp[105]; 13 char map[105][105]; 14 int max[105], len; 15 16 void create(char str[], int x) { 17 int i, j, id; 18 Trie *p = &root, *q; 19 20 for (i=0; str[i]!='