!7 p-exp { S sentence = "Are atomic bombs powerful devices ?"; S pat = "Are ?"; L tokPat = javaTokWithAngularBracketsC(pat); L tokS = javaTokWithAngularBracketsC(sentence); printStruct(tokPat); printStruct(tokS); int extra = l(tokS)-l(tokPat); L indices = indicesOfAngleBracketVars(tokPat); if (extra <= 0 || empty(indices)) ret with print("Not applicable"); print(indices); new LL out; recurse(extra, l(indices), new L, out); pnl(out); for (L spread : out) { new L tok; int pos = indices.get(0); for i over indices: { int idx = indices.get(i); int take = spread.get(i)+1; tok.addAll(subList(tokS, pos, idx)); tok.add(joinWithSpace(subList(tokS, pos, pos+take))); pos += take; } tok.addAll(subList(tokS, pos)); printStruct(tok); } } svoid recurse(int remaining, int n, L collecting, LL out) { if (l(collecting) >= n-1) ret with out.add(listPlus(cloneList(collecting), remaining)); for (int take = 0; take <= remaining; take++) { collecting.add(take); recurse(remaining-take, n, collecting, out); removeLast(collecting); } }