Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#pragma region usual_defs
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cmath>

// this is the only reason I like C++ (sorry, java, try to be more fun next time):
#define meow cin
#define murr cout
#define lol long long
#define lmao unsigned long long
#define el '\n'
#define none \
    {        \
    }
#define kaput return
#define kill break
#define nah continue
using namespace std;
#pragma endregion usual_defs
// #define SYNC
#define i_like_cats

int n;
string str;
bool l, _s, _p;
void cat()
{
    meow >> n;
    meow.ignore();
    getline(meow, str);
    _s = false;
    _p = false;
    for (int i = 0; i < n; i++)
    {
        if (str[i] == 's')
            _s = true;
        else if (str[i] == 'p')
            _p = true;
    }
    if (!(_s && _p))
    {
        murr << "YES\n";
        kaput;
    }

    _p = true;
    for (int i = 0; i < n - 1; i++)
    {
        if (str[i] == 'p')
        {
            _p = false;
            kill;
        }
    }
    if (_p)
    {
        murr << "YES\n";
        kaput;
    }

    _s = true;
    for (int i = 1; i < n; i++)
    {
        if (str[i] == 's')
        {
            _s = false;
            kill;
        }
    }
    if (_p)
    {
        murr << "YES\n";
        kaput;
    }
    murr << "NO\n";
}

#pragma region main
#ifdef i_like_cats
int INPUT_SETS_COUNT;
#endif
int main()
{
    ios_base::sync_with_stdio(false);
#ifndef SYNC
    meow.tie(NULL);
#endif
#ifdef i_like_cats
    meow >> INPUT_SETS_COUNT;
    meow.ignore();
    while (INPUT_SETS_COUNT--)
        cat();
#endif
#ifndef i_like_cats
    cat();
#endif
}
#pragma endregion main


Submission (verdict: Accepted):
#pragma region usual_defs
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cmath>

// this is the only reason I like C++ (sorry, java, try to be more fun next time):
#define meow cin
#define murr cout
#define lol long long
#define lmao unsigned long long
#define el '\n'
#define none \
    {        \
    }
#define kaput return
#define kill break
#define nah continue
using namespace std;
#pragma endregion usual_defs
// #define SYNC
#define i_like_cats

int n;
string str;
bool l, _s, _p;
void cat()
{
    meow >> n;
    meow.ignore();
    getline(meow, str);
    _s = false;
    _p = false;
    for (int i = 0; i < n; i++)
    {
        if (str[i] == 's')
            _s = true;
        else if (str[i] == 'p')
            _p = true;
    }
    if (!(_s && _p))
    {
        murr << "YES\n";
        kaput;
    }

    _p = true;
    for (int i = 0; i < n - 1; i++)
    {
        if (str[i] == 'p')
        {
            _p = false;
            kill;
        }
    }
    if (_p)
    {
        murr << "YES\n";
        kaput;
    }

    _s = true;
    for (int i = 1; i < n; i++)
    {
        if (str[i] == 's')
        {
            _s = false;
            kill;
        }
    }
    if (_s)
    {
        murr << "YES\n";
        kaput;
    }
    murr << "NO\n";
}

#pragma region main
#ifdef i_like_cats
int INPUT_SETS_COUNT;
#endif
int main()
{
    ios_base::sync_with_stdio(false);
#ifndef SYNC
    meow.tie(NULL);
#endif
#ifdef i_like_cats
    meow >> INPUT_SETS_COUNT;
    meow.ignore();
    while (INPUT_SETS_COUNT--)
        cat();
#endif
#ifndef i_like_cats
    cat();
#endif
}
#pragma endregion main