Language: C++


#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
  string s;
  cin >> s;
  int n = s.size(),co=0;
  string rs = s;
  reverse(rs.begin(), rs.end());
  if(rs == s) co++;
  

  string ts = s.substr(0,(n-1)/2);
  string trs = ts;
  reverse(trs.begin(), trs.end());
  if(ts == trs) co++;
  
  string ks = s.substr((n+3)/2-1);
  string krs = ks;
  reverse(krs.begin(),krs.end());
  if(krs == ks) co++;


  if(co == 3){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }

  



  return 0;


}



Compiler output:
a.cc:11:9: error: 'vector' does not name a type
   11 | typedef vector<ll> VL;
      |         ^~~~~~
a.cc:12:9: error: 'vector' does not name a type
   12 | typedef vector<VL> VVL;
      |         ^~~~~~
a.cc:13:9: error: 'vector' does not name a type
   13 | typedef vector<int> VI;
      |         ^~~~~~
a.cc:14:9: error: 'pair' does not name a type
   14 | typedef pair<ll, ll> P;
      |         ^~~~
a.cc:18:17: error: 'string' was not declared in this scope
   18 | ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
      |                 ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | 
a.cc: In function 'bool is_prime(ll)':
a.cc:19:61: error: 'sqrt' was not declared in this scope
   19 | bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }
      |                                                             ^~~~
a.cc: In function 'int main()':
a.cc:23:3: error: 'string' was not declared in this scope
   23 |   string s;
      |   ^~~~~~
a.cc:23:3: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:24:3: error: 'cin' was not declared in this scope
   24 |   cin >> s;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:24:10: error: 's' was not declared in this scope
   24 |   cin >> s;
      |          ^
a.cc:26:9: error: expected ';' before 'rs'
   26 |   string rs = s;
      |         ^~~
      |         ;
a.cc:27:11: error: 'rs' was not declared in this scope
   27 |   reverse(rs.begin(), rs.end());
      |           ^~
a.cc:27:3: error: 'reverse' was not declared in this scope
   27 |   reverse(rs.begin(), rs.end());
      |   ^~~~~~~
a.cc:28:15: error: 'co' was not declared in this scope
   28 |   if(rs == s) co++;
      |               ^~
a.cc:31:9: error: expected ';' before 'ts'
   31 |   string ts = s.substr(0,(n-1)/2);
      |         ^~~
      |         ;
a.cc:32:9: error: expected ';' before 'trs'
   32 |   string trs = ts;
      |         ^~~~
      |         ;
a.cc:33:11: error: 'trs' was not declared in this scope
   33 |   reverse(trs.begin(), trs.end());
      |           ^~~
a.cc:34:6: error: 'ts' was not declared in this scope
   34 |   if(ts == trs) co++;
      |      ^~
a.cc:34:17: error: 'co' was not declared in this scope
   34 |   if(ts == trs) co++;
      |                 ^~
a.cc:36:9: error: expected ';' before 'ks'
   36 |   string ks = s.substr((n+3)/2-1);
      |         ^~~
      |         ;
a.cc:37:9: error: expected ';' before 'krs'
   37 |   string krs = ks;
      |         ^~~~
      |         ;
a.cc:38:11: error: 'krs' was not declared in this scope
   38 |   reverse(krs.begin(),krs.end());
      |           ^~~
a.cc:39:13: error: 'ks' was not declared in this scope
   39 |   if(krs == ks) co++;
      |             ^~
a.cc:39:17: error: 'co' was not declared in this scope
   39 |   if(krs == ks) co++;
      |                 ^~
a.cc:42:6: error: 'co' was not declared in this scope
   42 |   if(co == 3){
      |      ^~
a.cc:43:7: error: 'cout' was not declared in this scope
   43 |       cout << "Yes" << endl;
      |       ^~~~
a.cc:43:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:43:24: error: 'endl' was not declared in this scope
   43 |       cout << "Yes" << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | 
a.cc:45:7: error: 'cout' was not declared in this scope
   45 |       cout << "No" << endl;
      |       ^~~~
a.cc:45:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:45:23: error: 'endl' was not declared in this scope
   45 |       cout << "No" << endl;
      |                       ^~~~
a.cc:45:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'