ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1038. Spell Checker

why wa#10 (c#)
Posted by Ras Misha [t4ce] 18 Sep 2009 20:18
using System;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string razd=":;, -";
            string kp=".!?";
            string dig = "0123456789";
            string[] input = Console.In.ReadLine().Split(
            new char[] {  '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            int cnt = 0;
            int ns = 0;
            int nb = 0;
            for (int i = 0; i < input.Length; i++)
            {
                string s = input[i];
                for (int j = 0; j < s.Length; j++)
                {
                    if ((s[j] >= 'A' && s[j] <= 'Z') || (s[j]>='a' && s[j]<='z') || dig.IndexOf(s[j])>=0)
                    {
                        nb++;
                        if (ns == 0) ns++;
                        if (nb == 1 && ns == 1 && (s[j] >= 'a' && s[j] <= 'z')) cnt++;
                        if ((s[j] >= 'A' && s[j] <= 'Z') && nb > 1) cnt++;
                    }
                    if (razd.IndexOf(s[j]) >= 0)
                    {
                        nb=0;
                        if (ns > 0) ns++;
                    }
                    if (kp.IndexOf(s[j])>=0)
                    {
                        ns = 0;
                        nb = 0;
                    }
                }
                nb = 0;
            }
            Console.WriteLine(cnt.ToString());
            Console.ReadKey();
        }
    }
}
Re: why wa#10 (c#)
Posted by timus_bottle 12 Jan 2010 15:50
i got wa in #10 too
try this
Asf,.,a
the ans is 1