Company: Tally_24july
Difficulty: medium
Palindrome Transformation Problem Description You are given two strings, s1 and s2. The goal is to turn s2 into the palindrome of s1 by replacing some of s2's letters with any letters you choose. Work out the fewest number of letters in s2 that must be replaced for it to become the palindrome of s1. Input Format The first line will be string s1. The second line will be string s2. Output Format Print the minimum number of letters to replace or -1 if it is impossible to make s2 as the palindrome of s1. Examples Example 1: Input: abcda abcda Output: 2 Explanation: Given s1 = "abcda" and s2 = "abcda" . For s2 to be the palindrome of s1 , it needs to match the reverse of s1 exactly. Reversing s1 ( "abcda" ) gives "adcba" . Comparing s2 ( "abcda" ) against reversed_s1 ( "adcba" ) position by position: Position 0: s2[0] ('a') vs reversed_s1[0] ('a') - Match, no change needed. Position 1: s2[1] ('b') vs reversed_s1[1] ('d') - No match, needs replacement. Position 2: s2[2] ('c') vs reversed_s1[