fork download
  1.  
  2. //|Art|
  3. #include<iostream>
  4. #include <vector>
  5. #define inout() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  6. #define el cout << '\n'
  7. #define fi first
  8. #define se second
  9. #define pb push_back
  10. #define pf push_front
  11. #define ll long long
  12. #define N 100000
  13. #define sz(x) (x).size()
  14. #define all(v) (v).begin(), (v).end()
  15. #define FOR(a,b,c) for(int a=b;a<=c;++a)
  16. #define FORE(a,b,c) for(int a=b;a>=c;--a)
  17. #define __Art__ signed main()
  18. #define NAME "Art"
  19. using namespace std;
  20. string a;
  21. vector<int> v;
  22. int cnt, res, k;
  23. void sol(){
  24. getline (cin, a);
  25. a += ' ';
  26. cnt = 0, res = k = 1;
  27. v.clear();
  28. FOR (i, 0, sz(a) - 1) {
  29. if ('a' <= a[i] && a[i] <= 'z') ++cnt;
  30. else {
  31. if (cnt != 0) v.pb(cnt);
  32. cnt = 0;
  33. }
  34. }
  35. FOR (i, 1, sz(v) - 1) {
  36. if (v[i] == v[i - 1]) ++k, res = max (res, k);
  37. else k = 1;
  38. }
  39. cout << res, el;
  40. }
  41. __Art__{
  42. if (fopen(NAME".INP", "r")) {
  43. freopen(NAME".INP", "r", stdin);
  44. freopen(NAME".OUT", "w", stdout);
  45. }
  46. inout();
  47. int t = 1;
  48. cin >> t;
  49. cin.ignore();
  50. while (t--) sol();
  51.  
  52. cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  53. return (0 ^ 0);
  54. }
  55.  
Success #stdin #stdout #stderr 0.01s 5284KB
stdin
1
a aa bb cc def ghi
stdout
3
stderr
Time elapsed: 0.005033s