Improved the switch case in string calculator