substring problem solved