Dynamic programming

20.3 - Longest palindromic substring


Your task is to write a program which takes a string and prints out its longest substring.

Sample input 1

banana

Sample output 1

anana

Sample input 2

crabbaj

Sample output 2

abba
#include <string> #include <iostream> int main() { std::string s; std::cin >> s; }