Update chapter01.cpp

Validate the input argument "str". If it is not correctly set (str.length() < 1), just return the function . And if it contains only one character (str.length() == 1), again we just return the function.
Merge pull request #70 from zebraswen/patch-1

Update chapter01.cpp