Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

continuation

image text in transcribed

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.cpp

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

5. A review of the key behaviors is included.

Answered: 1 week ago