Varianta 39 / Subiectul 2 / Problema 5 |
#include<iostream.h> #include<string.h> void main() { int i,p,j; char s[255],v[]="aeiou"; cin.get(s,255); i=0; if(strchr(v,s[i])) { p=i; while(s[i]!=' ') i++; for(j=i-1;j>=p;j--) cout<<s[j]; } else while(s[i]!=' ') { cout<<s[i]; i++; } cout<<' '; i++; while(i<strlen(s)) { if(strchr(v,s[i]) && s[i-1]==' ') { p=i; while(s[i]!=' '&& i<strlen(s)) i++; for(j=i-1;j>=p;j--) cout<<s[j]; } else while(s[i]!=' ' && i<strlen(s)) { cout<<s[i]; i++; } i++; cout<<" "; } } |