Submission #1821059


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int main()
{
  string S;
  cin >> S;

  int cost = 0;
  for(int len = S.size(); true; len++) {

    string T = S;
    reverse(begin(T), end(T));

    bool match = true;
    for(int j = 0; j < S.size; j++) {
      if(S[j] == '*') continue;
      if(T[j] == '*') continue;
      if(S[j] != T[j]) match = false;
    }
    if(match) {
      cout << cost << endl;
      return (0);
    }
    S.push_back('*');
    ++cost;
  }
}

Submission Info

Submission Time
Task B - Concatenated Palindrome
User ei13333
Language C++14 (GCC 5.4.1)
Score 0
Code Size 498 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:26: error: invalid use of member function (did you forget the ‘()’ ?)
     for(int j = 0; j < S.size; j++) {
                          ^