Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.  
  9.     unsigned int N;
  10.     cin >> N;
  11.  
  12.     vector<bool> answer(N, true);
  13.  
  14.     for (int i = 0; i < N; ++i) {
  15.  
  16.         string in;
  17.         cin >> in;
  18.  
  19.         for (int j = 0; j < in.size(); ++j) {
  20.  
  21.             int count = 0;
  22.             int lastChar = in[j];
  23.  
  24.             int times = 0;
  25.  
  26.             while (count < in.size()) {
  27.  
  28.                 if (in[j + count] == lastChar) {
  29.                     times++;
  30.  
  31.                     if (times % 3 == 0) {
  32.  
  33.                         for (int k = j + count; k >= in.size() || k < j + count + times / 3; ++k) {
  34.                             if (in[k] != lastChar) {
  35.                                 answer[j] = false;
  36.                                 goto stop;
  37.                             }
  38.                         }
  39.  
  40.                     }
  41.                 }
  42.  
  43.                 count++;
  44.  
  45.             }
  46.  
  47.             stop:
  48.             continue;
  49.  
  50.         }
  51.  
  52.     }
  53.  
  54.     for (int l = 0; l < answer.size(); ++l) {
  55.         cout << answer[l] << endl;
  56.     }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement