title: My small c program crashes
body: <p>here is the program which is supposed to find the most common element in a string. But it crashes when I enter a string.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;string.h&gt;
  int main(){
      char a[100];
      scanf("%s", a);
      int max=0,n,k;
      int urt = strlen(a);
      for(int i=0; i&lt;urt-1; i++){
          n=0;
          for(int l=i+1; l&lt;urt; l++){
              if(a[i]==a[l]) n++;
          }
          if(max&lt;n){
              max=n; 
              k=i;
          }
      }
      printf("%s\n", a[k]);
      printf("%d", max);
      getch();
      return 0;
  }
  </code></pre>