Facebook
From bari, 10 Months ago, written in C++.
Embed
Download Paste or View Raw
Hits: 60
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.         char temp[3];
  6.         int copas=0, ouros=0, espadas=0, paus=0;
  7.         string baralho;
  8.         getline(cin, baralho);
  9.         for(int i=0;i<sizeof(baralho);i+=3){
  10.                 temp[0]=baralho[i];
  11.                 temp[1]=baralho[i+1];
  12.                 temp[2]=baralho[i+2];
  13.                 if(baralho[i] == '0') {
  14.                         if(baralho[i+2] == 'C' && baralho[i+1] != temp[1]) {
  15.                                 copas++;
  16.                         }
  17.                         else if(baralho[i+2] == 'E' && baralho[i+1] != temp[1]) {
  18.                                 ouros++;
  19.                         }
  20.                         else if(baralho[i+2] == 'U' && baralho[i+1] != temp[1]) {
  21.                                 espadas++;
  22.                         }
  23.                         else if(baralho[i+2] == 'P' && baralho[i+1] != temp[1]) {
  24.                                 paus++;
  25.                         }
  26.                         if(baralho[i+1] == temp[1]){
  27.                                 "Erro";
  28.                         }
  29.                 }
  30.                 else {
  31.                         temp[1]='1';
  32.                 }
  33.                 for(int j=0;j<3;j++){
  34.                         cout << temp[j] << "\n";
  35.                 }
  36.         }
  37.         return 0;
  38. }