[Mš Challenge] Alphabetical Balance Scale š āļø
Monday Blue š Challenge Series #14 Let's play with alphabets this week! This time we will need to put alphabets onto the balance scale at 2 ends to achieve equilibrium. If it's impossible to do so, determine the letter need to be added with minimum weight. The letters weight from 1 to 26 which corresponds to A to Z respectively. š¼ TASK Write a program to accept a string of uppercase letters and split into 2 groups which produce the minimum sum difference by using an underscore character "_". If the sum difference is not ZERO, we will need to add a letter (surround it with round brackets) on either side to achieve equilibrium. š§ TEST CASE "A" ā” (A)_A or A_(A) "AA" ā” A_A "AAA" ā” A(A)_AA or AA_A(A) "ABC" ā” AB_C "ABBA" ā” AB_BA "ABCD" ā” ABC_D(B) "ZEPHYRKOO" ā” ZEPHY_RKOO(U) "MONDAYBLUE" ā” MONDA(R)_YBLUE "CHRISTMAS" ā” CHRIS_TMAS(D) "IS" ā” I(J)_S "COMING" ā” COM_ING(A) "SOON" ā” SO_ON(E) ā¤ BONUS Clear-cut and optimized approach is encouraged. Happy Coding!!! šš»