reverse sort by legth of printed strings so sub strings will not be replaced before the full strings. few syntax errors and fixes