# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1168531 | nijat | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define fast_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define int long long
#define ld long double
#define endl '\n'
#define forUSACO freopen(".in", "r", stdin); freopen(".out", "w", stdout)
#define S second
#define F first
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 1e4 + 5;
const int sz = 1e5 + 5;
const int mod = 998244353;
const int INF = 1e18;
typedef tree<
int,
null_type,
less_equal<int>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
char a[N][N];
void solve()
{
int n, j = 0, ans = 0, ok = 0;
cin >> n;
string s, t = "ABXYY";
cin >> s;
for (int i = 0; i < n; i ++) {
if (s[i] == t[j]) j ++, ok = 1;
else j = 0;
ans = max(ans, j);
}
cout << max(ans, ok) << endl;
}
signed main()
{
fast_IO;
//forUSACO;
int T = 1;
//cin >> T;
while (T --)
{
solve();
}
}