|
|
back to boardC# RULEZ :) Posted by Zadrot 13 Mar 2007 01:49 using System; using System.Collections.Generic; using System.Text; namespace Timus { class Program { static void Main() { int mistakes = 0; string text = ""; while (true) { string s = Console.ReadLine(); if (s == null) break; text += ' ' + s; } string[] sentence = text.Split(new char[] { '!', '?', '.' }, StringSplitOptions.RemoveEmptyEntries); string[] words = text.Split(new char[] { ' ', '.', ' ', ',', ';', ':', '-', '!', '?'}, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < sentence.Length; i++) { sentence[i] = sentence[i].Trim(); if (sentence[i].Length > 0 && 'a' <= sentence[i][0] && sentence[i][0] <= 'z') mistakes++; }
for (int i = 0; i < words.Length; i++) for (int j = 1; j < words[i].Length; j++) if ('A' <= words[i][j] && words[i][j] <= 'Z') mistakes++; Console.WriteLine(mistakes); } } } Sorry for posting code, but maybe anybody try to write on C# after this post. Edited by author 13.03.2007 01:53 |
|
|