Spliting demo implementation and logic. Refactoring string algorithm to use pointers