title: Vigenere cipher in cs50
body: <p>I'm working my way through an online class teaching me how to code. I'm very new to this and have been slowly making my way through this class. I've run into an issue with the vingenere cipher. It doesn't iterate the key through the whole input. </p>
  
  <p>Edit: the key should iterate through the user input and when it reaches the end of the key, loop back and begin again. The key should also skip over any special character(!@#" ",etc)</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;cs50.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  
  int main (int argc, string argv[])
  {
      if(argc !=2)
      {
          printf("please put in command line argument: example - ./vigenere command\n");
          return 1;
      }
      string key = argv[1];
      int keylength = strlen(key);
      for (int i=0;i&lt;keylength; i++)
      {
          if(!isalpha(key[i]))
          {
              printf("please make sure command is letter only. Please no numbers or special characters!\n");
              return 1;
          }
      }
      string input = GetString();
  
      for (int i=0, k=0; i&lt;keylength; i++)
      {
          if(isalpha(input[i]))
          {
              if(isupper(input[i]))
              {
                  input[i]=((input[i]-'A')+(key[k%keylength]))%26+'A';
              }
              else
              {
                  if(islower(input[i]))
                  {
                  input[i]=((input[i]-'a')+(key[k%keylength]))%26+'a';
              }
          }
      }
  }
  printf("%s\n",input);
  return 0;
  }
  </code></pre>
  
  <p>I know string is not normal, but it's included in the header to help with new students. I guess we learn more as the class progresses. </p>