//100 puncte EmCerchez #include #include #include #define NMAX 16 #define LGS 16 #define LGMAX 15000000 using namespace std; ifstream fin("expand.in"); ofstream fout("expand.out"); int N, start, lgs; char G[26][NMAX][LGS]; int lg[26]; char s[LGS]; struct element {short int nr; char s[LGS];}; element C[LGMAX]; void citire(); int BFS(int start); int main() { citire(); fout<>L>>s>>N; assert('a'<=L && L<='z'); lgs=strlen(s); assert(lgs<=15); assert(N<=15); start=L-'a'; for (i=0; i>c; assert('a'<=c && c<='z'); fin>>G[c-'a'][lg[c-'a']]; lllg=strlen(G[c-'a'][lg[c-'a']]); assert(lllg==2 || lllg==3); lg[c-'a']++; } } int BFS(int start) { int inc=0, sf=0, i, j, k, lgx,t,z; element x; C[0].nr=0; C[0].s[0]=start+'a'; C[0].s[1]=0; while (inc<=sf) { x=C[inc++]; lgx=strlen(x.s); for (i=0; i