#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
map<string,int>mp;
bool fun(string s){
int n=s.size();
for(int i=0;i<n;i++){
if(s[i]!=s[n-i-1])return 0;
}
return 1;
}
signed main(){
string s;
cin>>s;
int n=s.size();
int ans=0;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
string p= s.substr(i,j-i+1);
if(fun(p)){
mp[p]++;
}
}
}
for(auto it=mp.begin();it!=mp.end();it++){
string g=it->ff;
int h=g.size();
ans=max(ans,h * it->ss);
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
428 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
432 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
91 ms |
1052 KB |
Output is correct |
2 |
Correct |
43 ms |
600 KB |
Output is correct |
3 |
Correct |
146 ms |
1060 KB |
Output is correct |
4 |
Correct |
26 ms |
588 KB |
Output is correct |
5 |
Correct |
183 ms |
1052 KB |
Output is correct |
6 |
Correct |
140 ms |
1068 KB |
Output is correct |
7 |
Correct |
32 ms |
936 KB |
Output is correct |
8 |
Correct |
91 ms |
860 KB |
Output is correct |
9 |
Correct |
25 ms |
600 KB |
Output is correct |
10 |
Correct |
23 ms |
348 KB |
Output is correct |
11 |
Correct |
23 ms |
348 KB |
Output is correct |
12 |
Correct |
29 ms |
680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1083 ms |
53172 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
167 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
162 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |