13a2t

オ #include <stdlib.h>
エ #include "trie.h"
ア #define SIZE 10
ウ struct trie { int val; triep child[SIZE]; };
カ triep trie_new() { 
ニ   int i;
テ   triep p = (triep)malloc(sizeof(struct trie));
ネ   p->val = -1;
コ   for(i = 0; i < 10; ++i) { p->child[i] = NULL; }
フ   return p;
ケ } 
ク void trie_put(triep p, char *s, int v) { 
シ   if(*s == '\0') { 
ノ     p->val = v;
ソ   } else if('0' <= *s && *s <= '9') { 
ト     int i = *s - '0';
セ     if(p->child[i] == NULL) { 
ヌ       p->child[i] = trie_new();
ケ     } 
ホ     trie_put(p->child[i], s+1, v);
ケ   } 
ケ } 
キ int trie_get(triep p, char *s) { 
シ   if(*s == '\0') { 
ヒ     return p->val;
ソ   } else if('0' <= *s && *s <= '9') { 
ト     int i = *s - '0';
セ     if(p->child[i] == NULL) { 
ハ       return -1;
ケ     } 
ヘ     return trie_get(p->child[i], s+1);
ケ   } 
ケ } 
----------
オ #include <stdlib.h>
エ #include "trie.h"
ア #define SIZE 10
ウ struct trie { int val; triep child[SIZE]; };
カ triep trie_new() { 
テ   triep p = (triep)malloc(sizeof(struct trie));
ニ   int i;
ネ   p->val = -1;
コ   for(i = 0; i < 10; ++i) { p->child[i] = NULL; }
フ   return p;
ケ } 
ク void trie_put(triep p, char *s, int v) { 
シ   if(*s == '\0') { 
ノ     p->val = v;
ソ   } else if('0' <= *s && *s <= '9') { 
ト     int i = *s - '0';
セ     if(p->child[i] == NULL) { 
ヌ       p->child[i] = trie_new();
ケ     } 
ホ     trie_put(p->child[i], s+1, v);
ケ   } 
ケ } 
キ int trie_get(triep p, char *s) { 
シ   if(*s == '\0') { 
ヒ     return p->val;
ソ   } else if('0' <= *s && *s <= '9') { 
ト     int i = *s - '0';
セ     if(p->child[i] == NULL) { 
ハ       return -1;
ケ     } 
ヘ     return trie_get(p->child[i], s+1);
ケ   }