Advertisement
Ritam_C

bit++ method 2

Feb 21st, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     int n;
  6.     cin >> n;
  7.     map<char, int> m;
  8.     m.insert({'+', 0});
  9.     m.insert({'-', 0});
  10.     while(n--){
  11.         string s;
  12.         cin >> s;
  13.         if(s[1] == '+'){
  14.             m['+']++;
  15.         } else{
  16.             m['-']++;
  17.         }
  18.     }
  19.     cout << m.begin()->second-m.rbegin()->second;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement