Skip to content

Commit 3e8a9b4

Browse files
Add files via upload
1 parent 39cdfe1 commit 3e8a9b4

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include <math.h>
2+
#include <stdio.h>
3+
#include <string.h>
4+
#include <stdlib.h>
5+
#include <assert.h>
6+
#include <limits.h>
7+
#include <stdbool.h>
8+
9+
int main(){
10+
int N,i,j;
11+
scanf("%d",&N);
12+
char *ptr,*str,*ptr1;
13+
char tmp[20],tmp1[30];
14+
char firstName[N][20];
15+
char emailID[N][30],*emid;
16+
for(i= 0; i < N; i++)
17+
{
18+
scanf("%s %s",firstName[i],emailID[i]);
19+
}
20+
for(i=1;i<N;i++)
21+
{
22+
for(j=1;j<N;j++)
23+
{
24+
if(strcmp(firstName[j-1],firstName[j])>0)
25+
{
26+
strcpy(tmp,firstName[j-1]);
27+
strcpy(firstName[j-1],firstName[j]);
28+
strcpy(firstName[j],tmp);
29+
strcpy(tmp1,emailID[j-1]);
30+
strcpy(emailID[j-1],emailID[j]);
31+
strcpy(emailID[j],tmp1);
32+
}
33+
}
34+
}
35+
for(j=0;j<N;j++)
36+
{
37+
//Aditya Seth
38+
ptr=strstr(emailID[j],"@");
39+
ptr1=strstr(emailID[j],"g");
40+
if(strcmp(ptr,"@gmail.com")==0 && strncmp(ptr1,"gamil@gmail",8)!=0 )
41+
printf("%s\n",firstName[j]);
42+
else
43+
{}
44+
}
45+
return 0;
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
int N;
8+
cin >> N;
9+
10+
vector<string> emails(N);
11+
vector<string> names(N);
12+
vector<string> gmailUsers;
13+
14+
for(int i = 0; i < N; i++)
15+
{
16+
cin >> names[i] >> emails[i];
17+
}
18+
19+
for(int i = 0; i < N; i++)
20+
{
21+
if(regex_match(emails[i], regex("(.*)@gmail.com")))
22+
gmailUsers.push_back(names[i]);
23+
}
24+
25+
sort(gmailUsers.begin(), gmailUsers.end());
26+
//Aditya Seth
27+
for(int index = 0; index < gmailUsers.size(); index++)
28+
{
29+
cout << gmailUsers[index] << endl;
30+
}
31+
32+
33+
return 0;
34+
}
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import re
2+
3+
arr = []
4+
5+
n = int(input())
6+
7+
for i in range(n):
8+
data = str(input()).split(" ")
9+
name = data[0]
10+
email = data[1]
11+
12+
if re.search(".+@gmail\.com$", email):
13+
arr.append(name)
14+
15+
arr.sort()
16+
#Aditya Seth
17+
for name in arr:
18+
print(name)

0 commit comments

Comments
 (0)