/ separate into symbols sepsymb:{[x] ii: where x = ` $ "_"; ii: distinct 0, ii; z: ii _ x; y: (enlist z[0]), 1 _' 1 _ z; / take away the initial underbar everywhere y} multisetintersect:{[x;y] g1: group x; key1: key g1; count1: count each value g1; g2: group y; key2: key g2; count2: count each value g2; goodkeys: key1[where key1 in key2]; i1: key1 ?/: goodkeys; i2: key2 ?/: goodkeys; mincounts: count1[i1] &' count2[i2]; :raze mincounts #' goodkeys; } x: "S"$ .z.x / drop q and the function name z: lower each sepsymb[x] z multisetintersect over z