/*
* welcome to EMC company. Output:comany EMC to welcome.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
char str[] = "welcome to EMC company.";
char temp;
int begin, end;
int j = strlen(str) - 2, i = 0;
while(j > i){
temp = str[i];
str[i] = str[j];
str[j] = temp;
j--;
i++;
}
printf("%s\n",str);
char endChar = str[0];
i = 0;
while(str[i]){
if(str[i] != ' '){
begin = i;
while(str[i]&&str[i]!=' '&&str[i]!='.')
i++;
//i = i-1;
end = i-1;
}
while(end > begin){
temp = str[begin];
str[begin] = str[end];
str[end] = temp;
end --;
begin ++;
}
i++;
}
//str[i] = endChar;
printf("%s\n",str);
return 0;
}
* welcome to EMC company. Output:comany EMC to welcome.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
char str[] = "welcome to EMC company.";
char temp;
int begin, end;
int j = strlen(str) - 2, i = 0;
while(j > i){
temp = str[i];
str[i] = str[j];
str[j] = temp;
j--;
i++;
}
printf("%s\n",str);
char endChar = str[0];
i = 0;
while(str[i]){
if(str[i] != ' '){
begin = i;
while(str[i]&&str[i]!=' '&&str[i]!='.')
i++;
//i = i-1;
end = i-1;
}
while(end > begin){
temp = str[begin];
str[begin] = str[end];
str[end] = temp;
end --;
begin ++;
}
i++;
}
//str[i] = endChar;
printf("%s\n",str);
return 0;
}