why the following C# program failing for the Chef and Chain problem.

I have added the following C# code and i would like to know why the program is not working as expected.
this solution is for the problem at link text

using System;

namespace PostiveNegativeCount
{
class Program
{
public delegate PerformActionDelegate PerformActionDelegate(ref char start, ref char end);

    static void Main(string[] args)
    {
        int tcases = 0;
        if (int.TryParse(Console.ReadLine(), out tcases) && tcases > 0 && tcases < 8)
        {
            for (int loop = 0; loop < tcases; ++loop)
            {
                string str = Console.ReadLine();
                int noOfChars = str.Length;
                bool isEven = noOfChars % 2 == 0;
                PerformActionDelegate fnToUse = null;
                char start = str[0], end = str[noOfChars - 1];
                int first = 0, last = noOfChars - 1, mid = noOfChars / 2, count = 0;
                if (isEven)
                {
                    end = Reverse(start);
                    fnToUse = SwapUs;
                }
                else if (start == '-')
                {
                    fnToUse = MakeAllPositive;
                }
                else
                    fnToUse = MakeAllNegative;

                for (; first < mid; ++first, --last)
                {
                    if (str[first] != start)
                        ++count;
                    if (str[last] != end)
                        ++count;
                    fnToUse = fnToUse(ref start, ref end);
                }
                if (!isEven)
                {
                    if (str[first] != start)
                        ++count;
                }

                Console.WriteLine(count);
            }
        }
        Console.ReadLine();
    }

    public static char Reverse(char val)
    {
        if (val == '+')
            return '-';
        else if (val == '-')
            return '+';
        return val;
    }

    public static PerformActionDelegate MakeAllPositive(ref char start, ref char end)
    {
        start = end = '+';
        return MakeAllNegative;
    }

    public static PerformActionDelegate MakeAllNegative(ref char start, ref char end)
    {
        start = end = '-';
        return MakeAllPositive;
    }

    public static PerformActionDelegate SwapUs(ref char start, ref char end)
    {
        char temp = start;
        start = end;
        end = temp;
        return SwapUs;
    }
}

}

It’s giving wrong answer because you have made a mistake somewhere. Fix it and please delete your code from the thread because it is from a running contest.

This is about Feb 15 Long contest. Do not post code about on-going (alive) contest. Delete the code, ask for help after the contest is over.