282A - Bit++ Codeforces || Codeforces 282A - Bit++ Solution

Problem Name: Bit++
Problem Code: 282A
Judge: Codeforces
Problem link: Bit++



Codeforces 282A - Bit++ Solution in C++/Cpp

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int result = 0;
    for (int i = 1; i <= n; i++)
    {
        string X1 = "X++", X2 = "++X", X3 = "--X", X4 = "X--";
        string statement;
        cin >> statement;
        if (statement == X1 || statement == X2)
        {
            result++;
        }
        if (statement == X3 || statement == X4)
        {
            result--;
        }
    }
    cout << result << endl;

    return 0;
}






Next Post Previous Post
No Comment
Add Comment
comment url