Advertisement
evgenko

Leo_H_lab9_1

Dec 13th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     char a[100];
  8.     fgets(a,sizeof(a),stdin);
  9.     char b[100] = "";
  10.     int word = 1;
  11.     for (int i=0;i<strlen(a);i++){
  12.         if (isalpha(a[i])){
  13.             if (islower(a[i])){
  14.                 a[i]-=' ';
  15.             }else{
  16.                 a[i]+=' ';
  17.             }
  18.         }
  19.         if (word%2 == 0){
  20.             strncat(b,&a[i],1);
  21.         }
  22.         if (a[i] == ' '){
  23.             word++;
  24.         }
  25.  
  26.     }
  27.     for (int i=strlen(b)-2;i>=0;i--){
  28.         printf("%c",b[i]);
  29.     }
  30.  
  31.     return 0;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement