## Algorithm

Problem Name: beecrowd | 3039

# Santa's Toys

By Matheus Fabian, URI Brazil

Timelimit: 1

Santa Claus reads Christmas letters every year to know what to give to each child. The problem is, many kids don't send their letters to Santa Claus, so he decided that to save his time, he will give the same gift to children who didn't send letters. So he decided that for children who are boys, he will give a toy car, and for girls a doll.

## Input

The first line of the entry has an integer N (0 < N ≤ 1000), the number of children who didn't send their letter to Santa. The next N lines consist of two strings, the first is the child's name, and the second is a letter, which can be 'M', to say it's a boy, or 'F' if it's a girl.

## Output

The output consists of 2 lines. The first line should contain the number of toy cars that Santa should make, followed by the word "carrinhos", and on the second line, the number of dolls followed by the word "bonecas".

 Input Sample Output Sample 5 Milena F Joao M Rafaela F Renata F Felipe M 2 carrinhos 3 bonecas

## Code Examples

### #1 Code Example with C Programming

```Code - C Programming```

``````
#include <stdio.h>

int main(int argc, char **argv)
{

char gen;
int n, c, b;
char string[100];

scanf("%d", &n);

b = c = 0;
while (n--)
{

scanf("%s%*c%c", string, &gen);

if (gen == 'F')
++b;
else
++c;

}

printf("%d carrinhos\n%d bonecas\n", c, b);

return 0;

}
``````
Copy The Code &

### #2 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <bits/stdc++.h>

using namespace std;

int main(){
string name;
int carsCount = 0, dollsCount = 0;

int testCase;
cin >> testCase;

char gender[testCase];

for(int i=0; i  <  testCase; i++){
cin >> name >> gender;

int mCompValue = strcmp(gender,"M");
int fCompValue = strcmp(gender,"F");

if(mCompValue == 0){
carsCount++;
}
if(fCompValue == 0){
dollsCount++;
}
}
cout << carsCount <<" carrinhos" << endl;
cout << dollsCount <<" bonecas" << endl;
}
``````
Copy The Code &

### #3 Code Example with Javascript Programming

```Code - Javascript Programming```

``````
var lines = input.split('\n');
const number = parseInt(lines.shift());
let carrinho = 0;
let boneca = 0;

for(let i = 0; i  <  number; i++){
let [a, b] = lines.shift().trim().split(" ");
b == "F" ? boneca++ : carrinho++;
}

console.log(`\${carrinho} carrinhos\n\${boneca} bonecas`);
``````
Copy The Code &