Skip to content

Instantly share code, notes, and snippets.

@PedroRacchetti
Created October 1, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PedroRacchetti/483526de51b4ec157078f43a4bd4b357 to your computer and use it in GitHub Desktop.
Save PedroRacchetti/483526de51b4ec157078f43a4bd4b357 to your computer and use it in GitHub Desktop.
#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