title: Take a list/array of names and count the number of times each unique name is listed
body: <p>The input for this code is:</p>
  
  <pre><code>"John, Mary, Joe, John, John, John, Mary, Mary, Steve."
  </code></pre>
  
  <p>My goal is to print out:</p>
  
  <blockquote>
    <p>"(Name) got (# of votes) votes."</p>
  </blockquote>
  
  <p>Ending with a statement of the winner.</p>
  
  <p>I can't seem to debug my code though. This is my code:</p>
  
  <pre><code>static void popularity_contest(List&lt;String&gt; name_list) {
  
      largest_count = "";
      largest_count = 0;
      int n = name_list.size();
      int count = 1;
      int y = sorted(name_list);
        for(i=1; i&lt;name_list.length; i++){
            if (n[i] == n[i-1]){
                count += 1;
            }
                else
                {
                    name = n[i-1];
                    System.out.println(n[i-1] + " got " + str.length(count) + " votes.");
                    if (count &gt; largest_count)
                    {
                            largest_count = count;
                            largest_name = name;
                            count = 1;
                     }
          System.out.println(str.length(y)-1 + " got " + str.length(count) + " votes.");
          name = str.length(y)-1;           
        }
            if (count &gt; largest_count)
            {
                largest_count = count;
                largest_name = name;
              System.out.print(largest_name + " Wins!");
            }
        }
  } 
  </code></pre>