Back
Close
  • 11

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

You are given a string s consisting of alphanumeric characters and underscores. By removing some characters from the string (but not reordering them), you can create a palindrome.

Your task is to determine the length of the longest palindrome that can be made.

A palindrome is a string that reads the same backward as forward.
- Examples: a, aba, aabbaa.
- Non-examples: ab, abc, aabbaaa.
Case is important: ABBA is a palindrome, but Abba is not.
Input
Line 1: The string s
Output
Line 1: The length of the longest palindrome that can be formed from s
Constraints
1 ≤ length of s ≤ 30
Example
Input
a
Output
1

A higher resolution is required to access the IDE