#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char s[100];
int i,j,k=0,dot=0;
printf("input your text:\n");
do
{ gets(s+k);
k = strlen(s);
s[k] = 0;
for (i=0;i<k;i++) if (s[i]==".") dot=1;
} while (dot==0);
if (s[0] >="a" && s[0] <="z") s[0]=s[0]-"a"+"A";
for (i=1;i<k;i++) {
if (s[i] >="A" && s[i] <="Z") s[i]=s[i]-"A"+"a";
}
for (i=1;i<k;i++) while (s[i-1]==" " && s[i] == " ") for (j=i;j<k;j++) s[j]=s[j+1];
printf("%s\n",s);
return 1;
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char s[100];
int i,j,k=0,dot=0;
printf("input your text:\n");
do
{ gets(s+k);
k = strlen(s);
s[k] = 0;
for (i=0;i<k;i++) if (s[i]==".") dot=1;
} while (dot==0);
if (s[0] >="a" && s[0] <="z") s[0]=s[0]-"a"+"A";
for (i=1;i<k;i++) {
if (s[i] >="A" && s[i] <="Z") s[i]=s[i]-"A"+"a";
}
for (i=1;i<k;i++) while (s[i-1]==" " && s[i] == " ") for (j=i;j<k;j++) s[j]=s[j+1];
printf("%s\n",s);
return 1;
}