Made a shorter version that uses the String scan method.