#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3", "sse2", "sse")
#pragma GCC target("avx", "sse4", "sse4.1", "sse4.2", "ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline", "fast-math", "unroll-loops", \
                     "no-stack-protector")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x = 0, long long y = 1234567890ll) {
  ++y;
  return (rng() % (y - x)) + x;
}
const long long mod = 1e9 + 7;
const long long m = 1e9 + 7;
const long long inf = 1e9 + 7;
const long double eps = 1e-9;
const double PI = atan(1) * 4;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <typename T>
inline int sign(const T &a) {
  if (a < 0) return -1;
  if (a > 0) return 1;
  return 0;
}
template <typename T, typename S>
inline bool amin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool amax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
template <typename A, typename B, typename C>
inline void in(A &x, B &y, C &z) {
  in(x);
  in(y);
  in(z);
}
template <typename A, typename B, typename C, typename D>
inline void in(A &x, B &y, C &z, D &d) {
  in(x);
  in(y);
  in(z);
  in(d);
}
template <typename T>
T MOD(T a, T m = (long long)1e9 + 7) {
  a %= m;
  if (a < 0) a += m;
  return a;
}
template <typename T>
T inv(T a, T m = (long long)1e9 + 7) {
  a = MOD(a, m);
  if (a <= 1) return a;
  return MOD((1 - inv(m, a) * m) / a, m);
}
template <typename A, typename B>
inline void in(A &x, B &y) {
  in(x);
  in(y);
}
long long twop(int x) { return 1LL << x; }
template <typename T>
T sqr(T x) {
  return x * x;
}
long long pwr(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long nCr(long long n, long long k) {
  long long res = 1;
  if (n < k) return 0;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res = (res * (n - i)) % mod;
    res = (res * pwr(i + 1, mod - 2)) % mod;
  }
  return res;
}
long long factorial(long long n) {
  if (n == 1) return 1;
  return (n * factorial(n - 1)) % mod;
}
long long catalan(long long n) {
  return (nCr(2 * n, n) * pwr(n + 1, mod - 2)) % mod;
}
namespace SOLVE {
int a[200005] = {0};
int longestSubSeg(int n, int k) {
  int cnt0 = 0;
  int l = 0;
  int max_len = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) cnt0++;
    while (cnt0 > k) {
      if (a[l] == 0) cnt0--;
      l++;
    }
    max_len = max(max_len, i - l + 1);
  }
  return max_len;
}
void solve() {
  string s1, s2, s3;
  long long n, m, p, d, k, x = 0, y = 0, c = 0, q, ans = 1234567890ll;
  in(n);
  string s;
  cin >> s;
  memset(a, 0, sizeof(a));
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'G') a[i] = 1, c++;
  }
  ans = longestSubSeg(n, 1);
  if (ans > c)
    cout << c << "\n";
  else
    cout << ans << "\n";
}
}  // namespace SOLVE
signed main() {
  int t = 1;
  while (t--) {
    SOLVE::solve();
  }
  return 0;
}

### Prompt

Please create a solution in CPP to the following problem:

Vova has won n trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row.

The beauty of the arrangement is the length of the longest subsegment consisting of golden trophies. Vova wants to swap two trophies (not necessarily adjacent ones) to make the arrangement as beautiful as possible — that means, to maximize the length of the longest such subsegment.

Help Vova! Tell him the maximum possible beauty of the arrangement if he is allowed to do at most one swap.

Input

The first line contains one integer n (2 ≤ n ≤ 10^5) — the number of trophies.

The second line contains n characters, each of them is either G or S. If the i-th character is G, then the i-th trophy is a golden one, otherwise it's a silver trophy. 

Output

Print the maximum possible length of a subsegment of golden trophies, if Vova is allowed to do at most one swap.

Examples

Input


10
GGGSGGGSGG


Output


7


Input


4
GGGG


Output


4


Input


3
SSS


Output


0

Note

In the first example Vova has to swap trophies with indices 4 and 10. Thus he will obtain the sequence "GGGGGGGSGS", the length of the longest subsegment of golden trophies is 7. 

In the second example Vova can make no swaps at all. The length of the longest subsegment of golden trophies in the sequence is 4. 

In the third example Vova cannot do anything to make the length of the longest subsegment of golden trophies in the sequence greater than 0.

### Response

```cpp
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize(3)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("sse3", "sse2", "sse")
#pragma GCC target("avx", "sse4", "sse4.1", "sse4.2", "ssse3")
#pragma GCC target("f16c")
#pragma GCC optimize("inline", "fast-math", "unroll-loops", \
                     "no-stack-protector")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x = 0, long long y = 1234567890ll) {
  ++y;
  return (rng() % (y - x)) + x;
}
const long long mod = 1e9 + 7;
const long long m = 1e9 + 7;
const long long inf = 1e9 + 7;
const long double eps = 1e-9;
const double PI = atan(1) * 4;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
template <typename T>
inline int sign(const T &a) {
  if (a < 0) return -1;
  if (a > 0) return 1;
  return 0;
}
template <typename T, typename S>
inline bool amin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool amax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
template <typename A, typename B, typename C>
inline void in(A &x, B &y, C &z) {
  in(x);
  in(y);
  in(z);
}
template <typename A, typename B, typename C, typename D>
inline void in(A &x, B &y, C &z, D &d) {
  in(x);
  in(y);
  in(z);
  in(d);
}
template <typename T>
T MOD(T a, T m = (long long)1e9 + 7) {
  a %= m;
  if (a < 0) a += m;
  return a;
}
template <typename T>
T inv(T a, T m = (long long)1e9 + 7) {
  a = MOD(a, m);
  if (a <= 1) return a;
  return MOD((1 - inv(m, a) * m) / a, m);
}
template <typename A, typename B>
inline void in(A &x, B &y) {
  in(x);
  in(y);
}
long long twop(int x) { return 1LL << x; }
template <typename T>
T sqr(T x) {
  return x * x;
}
long long pwr(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long nCr(long long n, long long k) {
  long long res = 1;
  if (n < k) return 0;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res = (res * (n - i)) % mod;
    res = (res * pwr(i + 1, mod - 2)) % mod;
  }
  return res;
}
long long factorial(long long n) {
  if (n == 1) return 1;
  return (n * factorial(n - 1)) % mod;
}
long long catalan(long long n) {
  return (nCr(2 * n, n) * pwr(n + 1, mod - 2)) % mod;
}
namespace SOLVE {
int a[200005] = {0};
int longestSubSeg(int n, int k) {
  int cnt0 = 0;
  int l = 0;
  int max_len = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) cnt0++;
    while (cnt0 > k) {
      if (a[l] == 0) cnt0--;
      l++;
    }
    max_len = max(max_len, i - l + 1);
  }
  return max_len;
}
void solve() {
  string s1, s2, s3;
  long long n, m, p, d, k, x = 0, y = 0, c = 0, q, ans = 1234567890ll;
  in(n);
  string s;
  cin >> s;
  memset(a, 0, sizeof(a));
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'G') a[i] = 1, c++;
  }
  ans = longestSubSeg(n, 1);
  if (ans > c)
    cout << c << "\n";
  else
    cout << ans << "\n";
}
}  // namespace SOLVE
signed main() {
  int t = 1;
  while (t--) {
    SOLVE::solve();
  }
  return 0;
}

```