View Code of Problem 114

#include<stdio.h>
#include<string.h>
int main(){
  char a[100];
  while(gets(a)!=NULL){
    int len=strlen(a),t=0;
    for(int i=0;i<len;i++){
      if((a[i]<='z'&&a[i]>='a')||(a[i]<='Z'&&a[i]>='A')){
        t=i;
        while((a[i+1]<='z'&&a[i+1]>='a')||(a[i+1]<='Z'&&a[i+1]>='A'))
          i++;
        for(int j=i;j>=t;j--){
            printf("%c",a[j]);
        }
      }
      else
        printf("%c",a[i]);
    }
    printf("\n");
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 114