Read sentences until user enters 0
for each sentence, if the first character in each word in the given sentence is vowel, append T and if it is not vowel replace that character by T.
Also only first character in each word only must be capital letter.
Sample Input:
love apples
apples are gOOOd for HelatHH
0
Sample Output:
Tove Tapples
Tapples Tare Toood Tor Telathh
#include<stdio.h>
int isvowel(char ch)
{
if(ch >='A' && ch <= 'Z')
ch=ch+32;
if(ch == 'a' ||ch == 'e'||ch == 'i'||ch == 'o'||ch == 'u')
return 1;
else
return 0;
}
int main()
{
char st[1000001];
scanf("\n%[^\n]\n",st);
while(st[0] != '0')
{
int i;
for(i=0;st[i]!='\0';i++)
{
if(st[i] >= 'A' && st[i] <= 'Z')
st[i]=st[i]+32;
if(i == 0|| (st[i-1] == ' ' && st[i] != ' '))
{
if(isvowel(st[i]))
printf("T%c",st[i]);
else
printf("T");
}
else
printf("%c",st[i]);
}
printf("\n");
scanf("\n%[^\n]\n",st);
}
return 0;
}
for each sentence, if the first character in each word in the given sentence is vowel, append T and if it is not vowel replace that character by T.
Also only first character in each word only must be capital letter.
Sample Input:
love apples
apples are gOOOd for HelatHH
0
Sample Output:
Tove Tapples
Tapples Tare Toood Tor Telathh
#include<stdio.h>
int isvowel(char ch)
{
if(ch >='A' && ch <= 'Z')
ch=ch+32;
if(ch == 'a' ||ch == 'e'||ch == 'i'||ch == 'o'||ch == 'u')
return 1;
else
return 0;
}
int main()
{
char st[1000001];
scanf("\n%[^\n]\n",st);
while(st[0] != '0')
{
int i;
for(i=0;st[i]!='\0';i++)
{
if(st[i] >= 'A' && st[i] <= 'Z')
st[i]=st[i]+32;
if(i == 0|| (st[i-1] == ' ' && st[i] != ' '))
{
if(isvowel(st[i]))
printf("T%c",st[i]);
else
printf("T");
}
else
printf("%c",st[i]);
}
printf("\n");
scanf("\n%[^\n]\n",st);
}
return 0;
}