题解 | 开心还是难过
开心还是难过
https://www.nowcoder.com/practice/bdbe8ce947e64745b6383f16807b6e77
str_ = str(input())
positions = []
start = 0
while start < len(str_) - 2:
pos = str_.find(':-', start)
if pos == -1:
break
positions.append(pos)
start = pos + 1
# print(positions)
sad = 0
happy = 0
for pos in positions:
kuohao = str_[pos+2]
if kuohao == '(':
sad+=1
elif kuohao == ')':
happy+=1
if happy == 0 and sad == 0:
print('None')
elif happy == sad:
print('Just so so')
elif happy > sad:
print('Happy')
elif sad > happy:
print('Sad')
查看11道真题和解析