Check the balance programming exercise.

Fair is fair. Or at least it must be. Lady Justice wants something from you. Her Beam balance (or Beam scale) is broken but she need to do her job. So she wants you to:

Write a function the checks if characters ‘a‘ and ‘b‘ in a string are in the same amount. Lets make this function case insensitive. Like the law.

"aabb" => 2a and 2b => yes 
"aababbzxc" => 3a and 3b => yes
"abb" => 1a and 2b => no

Scroll down for the solution of this coding problem.

    public static bool BeamScale(string input)
    //first lets make all letters the same case
    //ToLower() will make them lowercase
        input = input.ToLower();
    //we will need some variables for counting
        int a = 0;
        int b = 0;
    //then we will go through each letter in the string
    //and if we find any 'a' or 'b' we will count them
    //the ++ operator adds +1 to a integer.
        foreach (var item in input)
            if (item == 'a') a++;
            if (item == 'b') b++;
    //this == operator checks if the two things are equal
    //and return the result as a Boolean.
    //exactly what we need :)
        return a==b;