1 public class Solution {
 2     public List<String> generatePossibleNextMoves(String s) {
 3         List<String> result = new ArrayList<>();
 4         if (s.length() < 2) {
 5             return result;
 6         }
 7         
 8         for (int i = 0; i < s.length() - 1; i++) {
 9             if (s.charAt(i) == '+' && s.charAt(i+1) == '+') {
10                 result.add(s.substring(0, i) + "--" + s.substring(i+2));
11             }
12         }
13         return result;
14     }
15 }

 

posted on 2016-07-06 09:39  keepshuatishuati  阅读(206)  评论(0编辑  收藏  举报