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 1601. AntiCAPS

WA 1, Runtime error (access violation), C#.
Posted by susimus 29 Jul 2014 13:08
            var temp = "";
            var cond = false;
            var list = new List<string>();
            while ((temp = Console.ReadLine()) != "")
            {
                list.Add("");
                foreach (var item in temp)
                    if (char.IsLetter(item))
                        if (cond == false)
                        {
                            cond = true;
                            list[list.Count() - 1] += char.ToUpper(item);
                        }
                        else
                            list[list.Count() - 1] += char.ToLower(item);
                    else if ((item == 33) || (item == 46) || (item == 63))
                    {
                        cond = false;
                        list[list.Count() - 1] += item;
                    }
                    else
                        list[list.Count() - 1] += item;
            }
            foreach (var item in list)
                Console.WriteLine(item);
            Console.Read();

Can anybody help me?