-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path282A.cpp
More file actions
58 lines (49 loc) · 1.01 KB
/
282A.cpp
File metadata and controls
58 lines (49 loc) · 1.01 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
using std::string;
bool compareFunction(string s1, string s2){
int x = s1.compare(s2);
if(x ==0){
return true;
}else{
return false;
}
}
int main() {
int n;
int x =0;
std::cin>>n;
std::string l[n];
for (int i = 0; i < n; i++)
{
string s;
/*for (int i = 0; i < 3; i++)
{
string m;
std::cin>>m;
s.append(m);
}*/
std::cin>>s;
l[i]=s;
}
std:: string preAdd = "++X";
std:: string postAdd = "X++";
std:: string preSub = "--X";
std:: string postSub = "X--";
for (int i = 0; i < n; i++)
{
if (compareFunction(l[i],postAdd) or compareFunction(l[i],preAdd))
{
x++;
}
if (compareFunction(l[i],postSub) or compareFunction(l[i],preSub))
{
x--;
}
else
{
continue;
}
}
std::cout << x << std::endl;
return 0;
}