Answered step by step
Verified Expert Solution
Question
1 Approved Answer
continuation want detailed code urgently 2. Palindrome - A palindrome is a sequence of characters that is the same when read backwards and forwards, e.g
continuation
want detailed code urgently
2. Palindrome - A palindrome is a sequence of characters that is the same when read backwards and forwards, e.g MALAYALAM ABBA R2D22D2R etc. Write a program palindrome.cpp which takes as input a nxn 2D array of characters, and counts the number of rows which are palindromes, number of columns which are palindromes and the number of major diagonals which are palindromes. Assume the maximum value of n is 100 and all characters are capital letters Input Format : The first line contains n, the dimension of the 2D (square) array. Lines 2 to n + 1 contain a string of n characters terminated by a newline. Newline is not considered to be a part of the string. Output Format : Print the number of palindromes on a single line. Sample input 1: 2 ON NO Sample output 1: 2 Explanation: the two major diagonals 00 and NN are palindromes; there are no rows or columns which are palindromes Sample input 2: 3 AAA BBB CCC Sample output 2: 3 Explanation : All the 3 rows (AAA, BBB, CCC) are palindromes. No columns or major diagonals are palindromes. Filename: palindrome.cppStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started