Skip to main content
deleted 66 characters in body
Source Link

Lua, 103103 91 bytes

s,l=...s:gsub('.',load'c=(...):gsub("%W","%%%1")b=b or not s:find(c..c,1,1)and s:find(c,1,1)')print(b%l-1,b//l) 

Try it online!Try it online!

Ungolfed version:

s,l=...  --Take in haystack and line width as args s:gsub('.',function (d) --For each character in s  c=d:gsub("%W","%%%1")  --ApplyFor escapeeach character toin non-alphanumericss b=b or not s:find(c..c,1,1)and s:find(c,1,1)  --If there is only one instance of c, store location end) print(b%l-1,b//l)  --Print results 

Lua, 103 bytes

s,l=...s:gsub('.',load'c=(...):gsub("%W","%%%1")b=b or not s:find(c..c)and s:find(c)')print(b%l-1,b//l) 

Try it online!

Ungolfed version:

s,l=... --Take in haystack and line width as args s:gsub('.',function (d) --For each character in s  c=d:gsub("%W","%%%1")  --Apply escape character to non-alphanumerics b=b or not s:find(c..c)and s:find(c) --If there is only one instance of c, store location end) print(b%l-1,b//l) --Print results 

Lua, 103 91 bytes

s,l=...s:gsub('.',load'c=...b=b or not s:find(c..c,1,1)and s:find(c,1,1)')print(b%l-1,b//l) 

Try it online!

Ungolfed version:

s,l=...  --Take in haystack and line width as args s:gsub('.',function (d) --For each character in s b=b or not s:find(c..c,1,1)and s:find(c,1,1)  --If there is only one instance of c, store location end) print(b%l-1,b//l)  --Print results 
Source Link

Lua, 103 bytes

s,l=...s:gsub('.',load'c=(...):gsub("%W","%%%1")b=b or not s:find(c..c)and s:find(c)')print(b%l-1,b//l) 

Try it online!

Ungolfed version:

s,l=... --Take in haystack and line width as args s:gsub('.',function (d) --For each character in s c=d:gsub("%W","%%%1") --Apply escape character to non-alphanumerics b=b or not s:find(c..c)and s:find(c) --If there is only one instance of c, store location end) print(b%l-1,b//l) --Print results