Arrows (UVA 13047) by beet1333
Contest: 3738    RunID: 20173546    Status: Wrong answer    Date: Sat Oct 14 13:42:55 JST 2017


#include<bits/stdc++.h>

using namespace std;

struct BeetAizu
{
  BeetAizu()
  {

  }

  void run()
  {
    string S;
    cin >> S;

    int ret = 0;
    for(int i = 0; i + 1 < S.size(); i++) {
      if(S[i] == '<') {
        char c = S[i + 1];
        ret = max(ret, 1);
        if(c != '=' && c != '-') continue;
        int tail = i + 1;
        while(tail < S.size() && c == S[tail]) ++tail;
        ret = max(ret, tail - i);
      }
    }

    for(int i = (int) S.size() - 1; i > 0; i--) {
      if(S[i] == '>') {
        char c = S[i - 1];
        ret = max(ret, 1);
        if(c != '=' && c != '-') continue;
        int tail = i - 1;
        while(tail >= 0 && c == S[tail]) --tail;
        ret = max(ret, i - tail);
      }
    }

    if(ret == 0) cout << -1 << endl;
    else cout << ret << endl;
  }
};

int main()
{
  BeetAizu beet;
  int T;
  cin >> T;
  for(int i = 1; i <= T; i++) {
    cout << "Case " << i << ": ";
    beet.run();
  }
}