| Bytes | Lang | Time | Link |
|---|---|---|---|
| 101 | JavaScript Node.js | 250517T153752Z | l4m2 |
| 313 | Python3 | 250517T144937Z | Ajax1234 |
| 050 | Jelly | 170505T120034Z | Jonathan |
| 079 | Jelly | 170505T012301Z | fireflam |
| 088 | Retina | 170505T002232Z | Neil |
JavaScript (Node.js), 101 bytes
M=>!(W=m=>M.every(w=>[m-=(x="ifljIr't?-".search(w)%2+1||3+(w in{m,w,M,W})+(w<{}))]*[m-=x])*m)(W``/-2)
Python3, 313 bytes
A='abcdefghijklnopqrstuvxyz'
M=[a:="ilI'",b:="fjrt-",{*A}-{*a,*b,*'mw'},{*A.upper(),*'mw'}-{*a,*'MW'},'MW']
E=enumerate
def f(s):
S=sum(c:=[[j for j,a in E(M,1)if i in a][0]for i in s])
l=max(i for i,_ in E(c)if sum(c[:i])<=S/2)
return(U:=sum(c[:l]))==S/2 or((A:=U+c[l]/2)+(B:=sum(c[l+1:])+c[l]/2)==S and A==B)
Jelly, 52 50 bytes
Œuðẇ⁾MW+=
ẇЀ“fjrt“il-“I'”T_@Ç+3µ€Hx2FŒṖṖLÐṂS€E$€Ṁ
Try it online! (exceeds memory limitations on TIO for the "splitwoRdS" test case)
Although slower and more memory hungry than the below 50 byte alternative that borrows the reduction method from fireflame241's answer:
Œuðẇ⁾MW+=
ẇЀ“fjrt“il-“I'”T_@Ç+3µ€Hx2F+\©ð_ø®ṪHµẠ¬
How?
Œuðẇ⁾MW+= - Link 1, character index offset helper: character list c (of length one)
Œu - to uppercase
ð - dyadic chain separation (call that u)
⁾MW - char pair literal ['M', 'W']
ẇ - sublist exists in? (is u in there - True if c is 'm', 'w', 'M', or 'W')
= - equal? (vectorised u=c? [1] for uppercase or non-alpha c, [0] for lowercase c)
+ - add the two results (vectorises)
ẇЀ“fjrt“il-“I'”T_@Ç+3µ€Hx2FŒṖṖLÐṂS€E$€Ṁ - Main link: character list w
µ€ - for each c in w:
“fjrt“il-“I'” - list of character lists: ["fjrt","il-","I'"]
ẇЀ - sublist (w) exists in, mapped across right
T - truthy indexes (gets [the index at which the character was found] or an empty list)
Ç - call the last link (1) as a monad
_@ - subtract with reversed @rguments
+3 - add 3
H - halve (vectorises)
x2 - times two (repeats each list)
F - flatten into a single list
ŒṖ - partitions (all ways to split the list into contiguous slices)
Ṗ - pop (remove the right-most; the only one of length 1)
ÐṂ - filter keep those with minimal:
L - length
$€ - last two links as a monad for €ach
S€ - sum €ach
E - all (two) equal? (1 for a split, 0 otherwise)
Ṁ - maximum (1 if any split was possible, 0 otherwise)
Jelly, 79 bytes
“¡-Ị’b26
“µııẈḟ(µ⁹\fy¦°Ẓ=ȮH@Q0Ẋƈẏ9Ė=ẹṬɗƇ’ðœ?øØa;ØA;⁾'-ð,ø5Rx¢
¢yHx2+\©ð_ø®ṪHµẠ¬
Retina, 88 bytes
T`MWi\lI'`551
T`-fjrt`2
T`m\wL`4
T`l`3
\d
$*1
+`^ ?1(1* 1*( 1*)+)1 ?$
$1
^ ?(1+) \1? ?$