-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game of Thrones - I
48 lines (43 loc) · 925 Bytes
/
Game of Thrones - I
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
45
46
47
48
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
int main() {
string s;
cin>>s;
map<char, int>got;
for(int i = 0;i < s.length();i++)
{
if(got.find(s[i]) != got.end())
{
got[s[i]]++;
}
else
got.insert(std::make_pair(s[i] ,1));
}
int k = 0;
int len = s.length();
if((len % 2) != 0)
k = 1;
else
k = 0;
for (map<char,int>::iterator it=got.begin(); it!=got.end(); ++it)
{
if(((it->second)% 2 != 0))
{
if(k > 0)
k--;
else
{
cout<<"NO";
return 1;
}
}
}
cout << "YES";
return 0;
}