Advertisement
Guest User

C

a guest
May 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char ok1;
  6.     char ok2;
  7.     char ok3;
  8.     int lenth=0, i, sum=0, numli=0, numilli=0;
  9.  
  10.     while ((ok1=getchar()) !='@')
  11.     {
  12.         if ((ok1>='1')&&(ok1<='9'))
  13.         {
  14.             ok2=getchar();
  15.             ok3=ok2;
  16.             numli++;
  17.             lenth=ok1-'0';
  18.  
  19.             for (i=0;i<lenth-1;i++)
  20.             {
  21.                 ok2=getchar();
  22.                 if((ok2>='A')&&(ok2<='Z'))
  23.                 {
  24.                     if(ok2==ok3+1)
  25.                     {
  26.                         numli++;
  27.                     }
  28.                     else {numli-=(i+1);
  29.                     numilli+=(i+2);
  30.                     break;}
  31.                 }
  32.                 else {numli-=(i+1);
  33.                 numilli+=(i+1);
  34.                 break;}
  35.  
  36.                 ok3=ok2;
  37.             }
  38.             if (i==(ok1-'0'-1))
  39.             {
  40.                 sum++;
  41.             }}
  42.             else numilli++;
  43.     }
  44.  
  45.     printf("%d\n%d\n%d\n", sum,numli,numilli);
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement