hackertyper.net

Jelly, 4 bytes

ẋ3ṁ@

Try it online!

How it works

ẋ3ṁ@    Main link. Arguments: s (input string), t (file string)

ẋ3      Repeat s three times.
  ṁ@    Mold; reshape t like the previous result.
        This repeats the elements of t over and over until the length matches that
        of s repeated thrice.

J, 7 bytes

$~(3*#)

Takes two arguments, the text to be repeated and the user's input text.

Usage

The input text is formatted where , means to join and LF is the newline character.

   f =: $~(3*#)
   ('#include <stdio.h>', LF, 'int main() { }') f 'hello world'
#include <stdio.h>
int main() { }
   'hello' f 'hello world'
hellohellohellohellohellohellohel

Try it online. (tryj.tk)


Jelly, 9 bytes

⁴L×3
ẋ¢ḣ¢

Try it online!

⁴L×3     Define nilad as ¢:

 L       length of
⁴        second argument
  ×3     tripled


ẋ¢ḣ¢     Main chain:
       
         the first argument (implicit)
ẋ        repeated
 ¢       ¢ many times
  ḣ¢     then get the first ¢ characters of it.

Tags:

Code Golf