Well, I really want to see that the trie tree is used for classification, but I have no idea about it, and I am using brute force.
If the same word cannot be found, there are only three similar cases.
CodeGood understanding
# Include <iostream> using namespace STD; # define maxn 10001 char STR [maxn] [20]; bool Replace (char * a, char * B) {int L1 = strlen (a); int L2 = strlen (B); If (L1 = l2) // modify a character {int I = 0; while (I <L1 & A [I] = B [I]) // locate the position of the first different character I ++; while (++ I <L1) // check whether the subsequent characters are the same {if (a [I]! = B [I]) return false ;}} else if (L1 = l2 + 1) // Add a character {int I = 0; while (I <L2 & A [I] = B [I]) I ++; while (++ I <L1) // A skips a character and B compares {if (a [I]! = B [I-1]) return false;} else if (l1 + 1 = l2) // delete a character, which is similar to {int I = 0; while (I <L1 & A [I] = B [I]) I ++; while (I ++ <l2) {if (a [I-1]! = B [I]) return false ;}} else return false; return true ;}int main () {int I = 0; bool flag; char C [20]; while (scanf ("% s", STR [I ++])! = EOF & strcmp (STR [I-1], "#")! = 0); I --; while (scanf ("% s", c )! = EOF & strcmp (C ,"#")! = 0) {flag = false; For (Int J = 0; j <I; j ++) if (strcmp (STR [J], c) = 0) {flag = true; break;} If (FLAG) printf ("% s is correct \ n", c); else {printf ("% s:", C ); for (Int J = 0; j <I; j ++) {If (replace (STR [J], c) printf ("% s ", STR [J]);} printf ("\ n") ;}} return 0 ;}