Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java please. Given a string of letters find the minimum number of letters you have to remove from the string, so that a reordering

In java please. Given a string of letters find the minimum number of letters you have to remove from the string, so that a reordering of the letters will result in a palindrome. A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar.

Input

All input is read from the standard input stream. The input consists of any number of strings. The strings will contain a least 1 and at most 1000 characters, and will contain only lowercase letters 'a' through 'z'.

Output

All output is written to the standard output stream. Each line of the output consists a single decimal integer, one for each string in the input.

Sample

Sample input:

abc add 

The corresponding output:

2 0 

In the first case removing "bc" leaves the palindrom "a". And in the second case reordering "add" yields the palindrom "dad".

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

Outline the two competing definitions of human resource management.

Answered: 1 week ago

Question

Prepare an ID card of the continent Antarctica?

Answered: 1 week ago

Question

What do you understand by Mendeleev's periodic table

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago