Created
October 1, 2020 17:30
-
-
Save PedroRacchetti/483526de51b4ec157078f43a4bd4b357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
//aqui declaramos as variáveis que precisaremos no programa | |
string s; | |
int numfeliz, numtriste; | |
int main(){ | |
while(cin >> s){ //a funcao de entrada cin retorna falso quando não consegue mais ler | |
if(s.length() < 3) continue; //se essa palavra tem menos de tres caracteres, | |
//essa palavra com certeza não é um emoticon | |
for(int i = 0; i < s.length() - 2; i++){ | |
if(s[i] == ':' && s[i+1] == '-' && s[i+2] == ')' ) numfeliz++; | |
//somamos um no numero de emoticons felizes | |
if(s[i] == ':' && s[i+1] == '-' && s[i+2] == '(' ) numtriste++; | |
//somamos um no numero de emoticons tristes | |
} | |
} | |
//comparamos os numeros de emoticons | |
if(numfeliz == numtriste) cout << "neutro" << endl; | |
else if(numfeliz > numtriste) cout << "divertido" << endl; | |
else cout << "chateado" << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment