Pregunta de entrevista de Tata Consultancy Services

Write a program to edit strings and calculate an answer.