fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n, x=0; cin >> n;
  7. while(n--) {
  8. string s; cin >> s;
  9. for(int i=0; i<s.length()-1; i++) {
  10. if(s[i] == s[i+1]) {
  11. if(s[i] == '+') x++;
  12. else x--;
  13. break;
  14. }
  15. }
  16. }
  17. cout << x << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5304KB
stdin
2
X++
--X
stdout
0