fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int counter;
  5. int main() {
  6. // your code goes here
  7. int t;
  8. cin>>t;
  9. while(t--)
  10. {
  11. string s;string ns=""; counter=0;int c=0;int q=0;
  12. cin>>s;int n=s.length();
  13. for(int i=0;i<n;i++)
  14. {
  15. if(s[i]!='#')
  16. {
  17. ns=ns+s[i];
  18. q++;
  19. if(s[i+1]=='#' && i!=n-1)
  20. {
  21. if(counter<q)
  22. {
  23. c++;
  24.  
  25. counter=q;
  26.  
  27. }
  28. ns="";q=0;
  29. }
  30. // cout<<counter<<endl;
  31. }
  32. }
  33.  
  34. cout<<c<<endl;
  35.  
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0s 16064KB
stdin
4
####
##.#..#
##..#.#
##.#....#
stdout
0
2
1
2