a DP version but fail with abcdba