AcWing 5354. 高兴还是悲伤
原题链接
简单
作者:
cui_zixu
,
2024-04-14 13:46:03
,
所有人可见
,
阅读 4
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int happy, sad;
int main()
{
string s;
getline(cin, s);
for (int i = 0; i < s.size(); i ++ )
{
if(s[i] == ':' && s[i + 1] == '-')
{
if(s[i + 2] == ')')
{
happy ++;
}else if(s[i + 2] == '(')
{
sad ++;
}
}
}
if(happy == 0 && sad == 0)
{
printf("none");
}else if(happy == sad)
{
printf("unsure");
}else if(happy > sad)
{
printf("happy");
}else if(sad > happy)
{
printf("sad");
}
return 0;
}