Checking whether a string is present in a bunch of other strings by row and expand columns to sign this test

I would like to have a data frame marked if a string from a vector of strings is present or not in a given column of a data frame by row. The following is a toy data and next is how I would like the outcome to be. It can go ok with loops, but if possible, I'd like to not use loop, once this data is about 3 million rows.

sapply loops through the letters A-G created by LETTERS[1:7]. grepl checks if each letter is present in a row of mydata$X17 and is transformed from a logical (TRUE / FALSE) to a binary integer (0 /1) with as.integer.

# test that the outcomes are the same
identical(outcome, outcome2)
[1] TRUE

Email codedump link for Checking whether a string is present in a bunch of other strings by row and expand columns to sign this test