fork download
  1. Line1 = io.read()
  2. Line2 = io.read()
  3. I,J = Line2:match("(.) (.)") -- boobs return the char flags
  4. i = Line1:find(I) -- find location of flags
  5. j = Line1:find(J)
  6. K,c = Line1:gsub(I,'') -- replace flag w/ empty & store in K
  7. _,b = K:gsub(J,'') -- taking K ensures single flags fail
  8. if i > j then i,j=j,i end -- ensure we start low to high
  9. if i==j or not (c+b==2) then
  10. print('"null"')
  11. else
  12. print('"'..Line1:sub(i+1,j-1)..'"')
  13. end
Success #stdin #stdout 0s 2836KB
stdin
Hello! What's your name?
! ?
stdout
" What's your name"