title: Count the number of frequency for different characters in a string
body: <p>i am currently tried to create a small program were the user enter a string in a text area, clicks on a button and the program counts the frequency of different characters in the string and shows the result on another text area.
  E.g. Step 1:- User enter:- aaabbbbbbcccdd
       Step 2:- User click the button
       Step 3:- a 3
                b 6
                c 3
                d 1
  This is what I've done so far....</p>
  
  <pre><code>    public partial class Form1 : Form
      {
          Dictionary&lt;string, int&gt; dic = new Dictionary&lt;string, int&gt;();
          string s = "";
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
  
              s = textBox1.Text;
              int count = 0;
              for (int i = 0; i &lt; s.Length; i++ )
              {
                  textBox2.Text = Convert.ToString(s[i]);
                  if (dic.Equals(s[i]))
                  {
                      count++;
                  }
                  else
                  {
                      dic.Add(Convert.ToString(s[i]), count++);
                  }
              }
  
          }
      }
  }
  </code></pre>
  
  <p>Any ideas or help how can I countinue because till now the program is giving a run time error when there are same charachter!!</p>
  
  <p>Thank You</p>