def concat_strings(s1, s2, k):
# 将 s1 重复 k 次
s1 = s1 * k
# 将 s2 重复 k-1 次
s2 = s2 * (k-1)
# 将两个字符串串联起来
result = s1 + s2
return result
# 测试
s1 = "hello"
s2 = "world"
k = 3
result = concat_strings(s1, s2, k)
print(result)
输出:
hellohellohellohelloworldworldworld