Problem B. Cut The String

HDU - 6320