Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
using namespace std; void processString(string &input){ string result; remove_copy_if(input.begin(), input.end(), back_inserter(result), ptr_fun
(&ispunct)); for_each(result.begin(), result.end(), [](char &c){ c = ::toupper(c); }); input = result; } void solve(string input){ processString(input); int maxLength = 1; int low, high, start = 0; int len = input.length(); for(int i = 1; i < len; ++i){ low = i - 1; high = i + 1; while(input[low] == input[high] && low >= 0 && high < len){ if(high - low + 1 > maxLength){ start = low; maxLength = high - low + 1; } --low; ++high; } low = i - 1; high = i; while(input[low] == input[high] && low >= 0 && high < len){ if(high - low + 1 > maxLength){ start = low; maxLength = high - low + 1; } --low; ++high; } } cout << input.substr(start, maxLength) << endl; } int main(){ string in; while(cin >> in){ solve(in); } return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)