-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame_of_thrones_1.py
More file actions
59 lines (46 loc) · 791 Bytes
/
game_of_thrones_1.py
File metadata and controls
59 lines (46 loc) · 791 Bytes
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
49
50
51
52
53
54
55
56
57
58
59
# Game of Thrones - I
# https://www.hackerrank.com/challenges/game-of-thrones
import collections
'''
msg = "cdcdcdcdeeeef"
msg = "aaabbbb"
msg = "cdefghmnopqrstuvw"
'''
msg = raw_input()
msg = msg.lower()
even = odd = 0
letters = 'abcdefghijklmnopqrstuvwxyz1234567890'
d = collections.defaultdict(int)
for c in msg:
if (c in letters):
d[c] += 1
for c in d:
if (c in letters):
#print '%s %6d' % (c, d[c])
if (d[c] % 2 == 0):
even+=1
else:
odd+=1
if ((odd == 1 or odd == 0) and even >= 0):
print "YES"
else:
print "NO"
'''
#!/bin/ruby
def main
stack = []
gets.strip.split('').each { |c|
if !stack.index(c).nil?
stack.delete(c)
else
stack.push(c)
end
}
if stack.length <= 1
puts 'YES'
else
puts 'NO'
end
end
main
'''