제출 #919523

#제출 시각아이디문제언어결과실행 시간메모리
919523jpfr12회문 (APIO14_palindrome)C++17
23 / 100
1048 ms11948 KiB
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <fstream>
#include <bitset>
#include <iomanip>
 
typedef long long ll;
using namespace std;
int MOD = (int)1e9;
int MAXN = 1e6;
 
//classes

 
 
//global
string s;
int n;
unordered_map<string, ll> Map;

void sol(int left, int right){
  while(left >= 0 && right < n){
    if(s[left] != s[right]) return;
    string temp = s.substr(left, right-left+1);
    Map[temp]++;
    left--;
    right++;
  }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //ifstream fin("input.txt");
  //ofstream fout("output.txt");
  //stop
  cin >> s;
  n = s.length();
  for(int i = 0; i < n; i++){
    sol(i, i);
    sol(i, i+1);
  }
  ll ans = 0;
  for(auto& i: Map){
    ans = max(ans, (ll)(i.second * i.first.length()));
  }
  cout << ans << '\n';
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...