title: Spell Check Algorithm
body: <p>I am implementing an Spellcheck algorithm for my informatics class in c</p>
  
  <p>Special requirements are: </p>
  
  <ul>
  <li>everything in the main function</li>
  <li>no string class allowed</li>
  <li>keep it simple (for further reimplementation in assembler)</li>
  </ul>
  
  <p>So I am stuck now. I created a program but I cannot image how to implement it without <code>strstr</code> or <code>sscanf</code>.</p>
  
  <p>My Code:</p>
  
  <pre><code>int main() {
    char c;
    int index;
    int len = 0;
    char a[10000];
    char s[100];
    char *e;
    char ch = ';';
    char p = '.';
  
    while ((c = getchar()) != '\n') {
      a[index++] = c;
    }
  
    char *test;
    test = a;
    char *start;
  
    while (*test != ch)
      *++test;
  
    e = test;
    *e++ = 0;
  
    int k = 0;
    while (e[k] != p) {
      k++;
    }
    e[k] = 0;
    int x;
    int i, j, counter = 0;
  
    for (x = 0; 1 == sscanf(e += x, "%99s%n", s, &amp;x);)
      if (strstr(a, s))
        printf("*%s* ", s);
      else
        printf("%s ", s);
    puts(".");
  }
  </code></pre>
  
  <p>Any idea how to rewrite it? Especially i am looking for a <code>sscanf</code> alternative.</p>
  
  <p>EDIT:
  the input is declared as followed:<br>
  XY BCDE BX CDE CDEF;BCDE XY UV ABC CDE BX X A CDEF.</p>
  
  <p>This is the input string. It is divided into 2 parts by a ;</p>
  
  <p>The first is the dictionary. the second after the ; are the words to check.</p>
  
  <p>If the word is known, I need to print it on <code>stdout</code>. If not I print it with <code>"*"</code> surrounded.</p>