Problem p02546 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fast_work                                                              \\
  {                                                                            \\
    ios_base::sync_with_stdio(0);                                              \\
    cin.tie(0);                                                                \\
    cout.tie(0);                                                               \\
  }

const ll INF = 1e18 + 5, NMAX = 1e6 + 5, MOD = 1000000007, N = 1e9 + 5,
         LOG = 25;
const ld EPS = 1e-8, pi = 3.14159265358979323846;

signed main() {
  fast_work

      string s;
  cin >> s;

  if (s.back() == 's')
    s += "es";
  else
    s += "s";

  cout << s;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fast_work                                                              \\
  {                                                                            \\
    ios_base::sync_with_stdio(0);                                              \\
    cin.tie(0);                                                                \\
    cout.tie(0);                                                               \\
  }

const ll INF = 1e18 + 5, NMAX = 1e6 + 5, MOD = 1000000007, N = 1e9 + 5,
         LOG = 25;
const ld EPS = 1e-8, pi = 3.14159265358979323846;

signed solve() {
  string s;
  cin >> s;

  if (s.back() == 's')
    s += "es";
  else
    s += "s";

  cout << s;
}

signed main() {
  fast_work

      int t = 1;
  // cin >> t;

  while (t-- > 0)
    solve();
}