strange substring rule