fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. int main() {
  7. int t, day, max, step;
  8. char s[1000009];
  9. scanf("%d", &t);
  10. while(t--) {
  11. day=0;
  12. max=0;
  13. step=0;
  14. scanf("%s", s);
  15. for(int i=0; i<strlen(s); i++) {
  16. if(s[i]=='#') day=0;
  17. else day++;
  18. if(day>max && s[i+1]=='#') {
  19. max=day;
  20. step++;
  21. }
  22. }
  23. printf("%d\n", step);
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 4204KB
stdin
4
####
##.#..#
##..#.#
##.#....#
stdout
0
2
1
2