fork download
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3. int main()
  4. {
  5. int t;scanf("%d",&t);
  6. int i,j;
  7. long long int l;
  8. char str[5000000];
  9. //long long int arr[5000000];
  10. while(t--)
  11. {
  12. scanf("%s",str);
  13. l=strlen(str);
  14. long long int c=0,k=0;
  15. long long int ans=0;
  16. long long int arr[5000000]={0};
  17. for(i=0;i<l;i++)
  18. {
  19. if(str[i]=='.')
  20. {
  21. c=c+1;
  22. }
  23. if(str[i]=='#' && c!=0)
  24. {
  25. arr[k++]=c;
  26. c=0;
  27. }
  28. }
  29. long long int max=arr[0];
  30. if(max>0 && arr[0]>0) ans=1;
  31. for(i=1;i<k;i++)
  32. {
  33. if(arr[i]>max)
  34. {
  35. max=arr[i];
  36. ans++;
  37. }
  38. }
  39. printf("%lld\n",ans);
  40. }
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0.01s 54144KB
stdin
4
####
##...#
####
##
stdout
0
1
0
0