public class Solution {
public List<String> generatePossibleNextMoves(String s) {
List<String> res = new ArrayList<String>();
if (s == null || s.length() < 2) return res;
int len = s.length();
for (int i = 1; i < len; i++) {
if (s.charAt(i) == '+' && s.charAt(i - 1) == '+') {
StringBuilder sb = new StringBuilder();
sb.append(s.substring(0, i - 1)).append("--").append(s.substring(i + 1));
res.add(sb.toString());
}
}
return res;
}
}
public class Solution {
public List<String> generatePossibleNextMoves(String s) {
List<String> res = new ArrayList<String>();
char[] array = s.toCharArray();
for (int i = 0; i < array.length - 1; i++) {
if (array[i] == '+' && array[i + 1] == '+') {
array[i] = '-';
array[i + 1] = '-';
res.add(String.valueOf(array));
array[i] = '+';
array[i + 1] = '+';
}
}
return res;
}
}