Cisco interview question

String oprations with some cases