Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.52 KB | None | 0 0
  1. //Rextester.Program.Main is the entry point for your code. Don't change it.
  2. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.RegularExpressions;
  8.  
  9. namespace Rextester
  10. {
  11.     public class Program
  12.     {
  13.        
  14.         public static void Main(string[] args)
  15.         {
  16.             string input;
  17.             List<string> s = new List<string>();
  18.             while((input = Console.ReadLine()) != null ){
  19.                s.Add(input);
  20.             }
  21.            
  22.  
  23.             int uk = 0;
  24.             int maks = 0;
  25.             int res = 0;
  26.             int koji = 0;
  27.             int ind = 0;
  28.             foreach(string h in s){
  29.                 bool b1 = String.IsNullOrWhiteSpace(h);
  30.                 if(b1)continue;
  31.                 ind++;
  32.                 string pom = h;
  33.                 int duz = pom.Length;
  34.                 int pravaduz = 0;
  35.                 int last = -1;
  36.                 bool los = false;
  37.                 for(int i=0; i<duz; i++){
  38.                     if(Char.IsWhiteSpace(pom[i])){
  39.                          continue;
  40.                     }
  41.                     pravaduz++;
  42.                     if(last == -1){
  43.                         if(pom[i] >= 'a' && pom[i] <= 'z'){
  44.                             last = 0;
  45.                         }
  46.                         else if(pom[i] >= 'A' && pom[i] <= 'Z'){
  47.                             last = 1;
  48.                         }
  49.                         else{
  50.                             los = true;
  51.                             break;
  52.                         }
  53.                     }
  54.                     else{
  55.                         int tr = 0;
  56.                          if(pom[i] >= 'a' && pom[i] <= 'z'){
  57.                             tr = 0;
  58.                         }
  59.                         else if(pom[i] >= 'A' && pom[i] <= 'Z'){
  60.                             tr = 1;
  61.                         }
  62.                         else{
  63.                             los = true;
  64.                             break;
  65.                         }
  66.                         if(tr == last){los = true; break;}
  67.                         last = tr;
  68.                     }
  69.                 }
  70.                 if(los == false){
  71.                     res++;
  72.                     maks = Math.Max(pravaduz,maks);
  73.                 }
  74.                 continue;
  75.                
  76.             }
  77.             Console.WriteLine(res);
  78.             Console.WriteLine(maks);
  79.            
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement