[ACM]Q10298: Power String

[ACM]Q10298: Power String


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Q10298
{
    class Program
    {
        static private string str; static private string[] par = new string[1];
        static void Main(string[] args)
        {
            for (; ; )
            {
                Console.Write("string>>>");
                str = Console.ReadLine();
                if (str == ".") break;
                for (int i = 0; i < str.Length; i++)
                {
                    par[0] = str.Substring(0, i + 1);
                    if (str.Split(par, StringSplitOptions.RemoveEmptyEntries).Length == 0)
                    { Console.WriteLine("Ans={0}", str.Split(par, StringSplitOptions.None).Length - 1); break; }
                }
            }
        }
    }
}