fork(4) download
  1. import java.io.*;
  2.  
  3. class Attic
  4. {
  5. public static void main(String args[])throws IOException
  6. {
  7.  
  8. int t,arr,days,max;
  9. int[] a=new int[101];
  10. int holes;
  11. String s;
  12. t=Integer.parseInt(br.readLine());
  13. for(int k=0;k<t;k++)
  14. { max=0;
  15. arr=0;
  16. days=0;
  17. holes=0;
  18. s=br.readLine();
  19. for(int i=0;i<s.length();i++)
  20. {
  21. holes=0;
  22. while(s.charAt(i)=='.')
  23. {
  24. i++;
  25. holes++;
  26. }
  27. a[arr]=holes;
  28. arr++;
  29. }
  30.  
  31. for(int j=0;j<a.length;j++)
  32. {
  33. if(a[j]>max)
  34. {
  35. max=a[j];
  36. days++;
  37. }
  38. }
  39. System.out.println(days);
  40. }
  41. }
  42. }
Success #stdin #stdout 0.07s 380160KB
stdin
4
####
##.#..#
##..#.#
##.#....#
stdout
0
2
1
2