why was i given a WRONG ANSWER?
/* @JUDGE_ID: [22115CJ] [1002] [C] */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MIN_LINE_LEN 5
#define MAX_NUM_LEN 100
#define MAX_DICT_LEN 50000
#define MAX_WORD_LEN 50
char corr[] = {'2', '2', '2', '3', '3', '3', '4', '4', '1', '1', '5', '5', '6', '6', '0', '7', '0', '7', '7', '8', '8', '8', '9', '9', '9', '9'};
char getcode(char ichar);
int main(int argc, char *argv[]) {
char num_in[MAX_NUM_LEN] = {0};
char word_in[MAX_WORD_LEN] = {0};
char count_in[MIN_LINE_LEN] = {0};
int count = 0;
char decoded_word[MAX_NUM_LEN] = {0};
int num_ctr = 0;
int word_ctr = 0;
int num_in_len = 0;
int word_in_len = 0;
int match = 0;
int first_match = 0;
fgets((char *) &num_in, MAX_NUM_LEN, stdin);
do {
fgets((char *) &count_in, MIN_LINE_LEN, stdin);
count = atoi((const char *) count_in);
num_in_len = strlen(num_in);
while (count-- > 0) {
fgets((char *) &word_in, MAX_WORD_LEN, stdin);
word_in_len = strlen(word_in);
word_in[word_in_len - 1] = '\0';
/** loop through num_in and word_in, doing comparisons */
for(word_ctr=0; word_ctr < word_in_len; word_ctr++) {
decoded_word[word_ctr] = getcode(word_in[word_ctr]);
};
if (num_ctr == (num_in_len - 1)) break;
if (memcmp(&num_in[num_ctr], decoded_word, word_ctr - 1)
== 0) {
num_ctr = word_ctr - 1;
if (first_match == 0) {
first_match = 1;
}
else {
printf(" ");
};
printf("%s", word_in);
match = 1;
}
};
first_match = 0;
if (match == 0) {
printf("\nNo solution.");
}
match = 0;
fgets((char *) &num_in, MAX_NUM_LEN, stdin);
} while (memcmp(&num_in, "-1", 2));
return (0);
}
char getcode(char inchar) {
return corr[(inchar - 0x61) % 26];
}