Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
827 B
103
Indexable
Never
#include<stdio.h>
#include<string.h>
void thuong(char *s)
{
	int n = strlen(s);
	int i;
	for(i = 0;i<n;i++)
	{
		if('A' <= s[i] && s[i] <= 'Z')
		{
			s[i] += 32;
		}
	}
}

void noi(char *s, char *g)
{
	int n = strlen(s);
	int i;
	int j = 1;
	int cach = 0;
	for(i = 0;i<n;i++)
	{
		if(s[i] == ' ')
		{
            cach++;
		}
	}
	
	int count = 0;
	printf("%c", s[0]);
	for(i = 1;i<n;i++)
	{
		if(s[i] != ' ' && s[i-1] == ' ')
		{   
			count++;
			if(count == cach)
			{
				while(i<n)
				{
				    printf("%c", s[i]);
					i++;
				}
				break;
			}
			else 
            {
               printf("%c",s[i]);
            }
		}
	}
    printf("%s", g);
}
int main()
{   
    char s[100];
    gets(s);
    char g[]="@ptit.edu.vn";
    thuong(s);
	noi(s,g);
	return 0;
}