Nth Even length Palindrome | C ++ program to find n = th even length string . ; Function to find nth even length Palindrome ; string r to store resultant palindrome . Initialize same as s ; In this loop string r stores reverse of string s after the string s in consecutive manner . ; Driver code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; string evenlength ( string n ) { string res = n ; for ( int j = n . length ( ) - 1 ; j >= 0 ; -- j ) res += n [ j ] ; return res ; } int main ( ) { string n = "10" ; cout << evenlength ( n ) ; return 0 ; }