**Case1**: Given a Scala List of string

```
val l =List("@description", "AC", "T", "G", "+", "ZZZZ")

```

What's a good way to concatenate `"AC", "T", "G"`, the expected result is

```
List("@description", "ACTG", "+", "ZZZZ")

```

The rule is that starting from the second element, all strings should be concatenated until it hits another string that starts with `+`. It's related to [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format) format parsing given that the sequence lines could be wrapped. The function is expected to be functional (aka. pure). I thought it might be implemented with `foldLeft`.

**Update**: Thank you for your answers! But I realized the problem a bit more complicated, the following cases should also work

**Case2**, input:

```
val l = List("@desc", "AA", "T", "+foo", "XX", "X", "@desc2", "TT", "C", "+bar", "Y", "YY")

```

expected output:

```
List("@desc", "AAT", "+foo", "XXX", "@desc2", "TTC", "+bar", "YYY")

```

So there can be multiple FASTQ records in the list. In the above case, there are two. The description line must start with `@`.

**Case3**:

input:

```
val l = List("@desc", "AAA", "TTT", "+foo", "@desc", "X", "@desc2", "TT", "C", "+bar", "+", "YY")

```

expected output:

```
List("@desc", "AAATTT", "+foo", "@descX", "@desc2", "TTC", "+bar", "+YY")

```

This is the most challenging case of the three since the quality lines (i.e. lines after the first line starting with "+") can also start with `@` or `+`. e.g. "@desc" is actually part of the quality instead of the starting line of another record. The way to distinguish between description and quality lines could be that the length of the sequence lines and that of the quality lines must match. In the third case, e.g. `"AAATTT".length === "@descX".length`, and also `"TTC".length == "+YY".length`