Add solution without using native String method.