-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1218.cpp
More file actions
43 lines (33 loc) · 928 Bytes
/
1218.cpp
File metadata and controls
43 lines (33 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
int main() {
string linha, aux, num;
int cont = 1;
while(cin >> num) {
int fem = 0, masc = 0;
cin.ignore();
getline(cin, linha);
for(int i=0; i<linha.size(); i++) {
int res = isalpha(linha[i]);
if(isalpha(linha[i]) != 0){
if(aux == num){
if(linha[i] == 'F') fem++;
if(linha[i] == 'M') masc++;
}
aux.clear();
} else {
if(isalnum(linha[i]) != 0) aux += linha[i];
}
}
if(cont != 1) cout << endl;
cout << "Caso " << cont << ":" << endl;
cout << "Pares Iguais: " << fem + masc << endl;
cout << "F: " << fem << endl;
cout << "M: " << masc << endl;
cont++;
}
return 0;
}