tanzilamohita@gmail.com
http://codeforces.com/gym/100796/problem/L
#include<string>
#include<iostream>
using namespace std;
int main () {
int n, l, sc, fc;
string s;
while (cin >> n) {
cin >> s;
l = s.length();
sc = 0;
fc = 0;
if (n==1){
cout << "BORED" << endl;
}
else {
for (int i = 0; i < n-1; i++) {
if(s[i] == ':') {
if(s[i+1] == ')'){
sc++;
}
else if (s[i+1] == '('){
fc++;
}
}
else if (s[i] == ')'){
if (s[i+1] == ':'){
fc++;
}
}
else if (s[i] == '('){
if (s[i+1] == ':'){
sc++;
}
}
}
if (fc > sc){
cout << "SAD" << endl;
}
else if (sc > fc) {
cout << "HAPPY" << endl;
}
else {
cout << "BORED" << endl;
}
}
}
return 0;
}
No comments:
Post a Comment