|
|
вернуться в форумwhy wa#10 (c#) 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#) i got wa in #10 too try this Asf,.,a the ans is 1 |
|
|