-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01jun.txt
44 lines (35 loc) · 816 Bytes
/
01jun.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
string oddEven(string s) {
unordered_map<char,int> freq;
for(int i=0;i<s.length();i++)
{
freq[s[i]]++;
}
unordered_map<char,int> pos;
char ch='a';
for(int i=1;i<=26;i++)
{
pos[ch]=i;
ch++;
}
int x=0,y=0;
for(auto it:freq)
{
char eng=it.first;
if(pos[eng]%2!=0 && freq[eng]%2!=0)
{
y++;
}
else if(pos[eng]%2==0 && freq[eng]%2==0)
{
x++;
}
}
if((x+y)%2!=0)
{
return "ODD";
}
else
{
return "EVEN";
}
}