fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int counter=0,n;
  6. string a="",temp;
  7. cin>>n;
  8. if(n==1)
  9. {
  10. cout<<1;
  11. return 0;
  12. }
  13. for(int i=0;i<n;i++){
  14. temp=a;
  15. cin>>a;
  16. if(temp[1]==a[1])
  17. continue;
  18. else
  19. counter++;
  20. }
  21. cout<<counter;
  22. return 0;
  23. }
Success #stdin #stdout 0s 5504KB
stdin
6
10
10
10
01
10
10
stdout
3