second revision.  Using translate instead of walking through the string