# Sequence **by [Matt Hall](https://github.com/kwinkunks)** You have a string of lithology codes, reading from the **bottom up** of a geological section. There is a sample every metre. There are three lithologies: - **M**udstone - **F**ine sandstone or siltstone - **S**andstone The strings look like this: ...MFFSSFSSSS... Your data, when you receive it, will be much longer than this. We need to get some geological information from this string of codes. Specifically, you need to answer 3 questions: 1. What is the total thickess in metres of sandstone (`S`)? Each sample represents one metre. 2. How many sandstone beds are there? A bed is a contiguous group of one lithology, so `MMFFF` is 2 beds, one of `M` and one of `F`. 3. How many times does the most common *upwards* bed transition occur? Do not include transitions from a lithology to itself. Remember that the sequence is given to you from the bottom up. So an upwards transition is equivalent to a transition from left to right. ## Example Here is some example input: SSMMFFFFFFFFSSMFFSSFSSSSFMFSSSSFFSSFFFMMS ^^ ^^ ^^ ^^^^ ^^^^ ^^ ^ And the answers to the 3 questions: - In this example, the total thickess of sandstone is 17 m. So the required answer is: **17** - There are 7 sandstone beds in the sequence (marked above). The answer is: **7** - The most common bed transition is `F` to `S`, which occurs 5 times. So the answer is: **5** ## A quick reminder how this works This document is formatted in [Markdown](https://daringfireball.net/projects/markdown/). You can retrieve your data, which is always a string, by choosing a **``** (also a string). This ensures that you have different data from other people, so be creative. ``` url = 'https://kata.scienxlab.org/challenge/sequence' params = { 'key': # Replace with your own string. } r = requests.get(url, params) r.text ``` To answer question 1, change the `params`: ``` params = { 'key': , # Use the same key you used to get your input. 'question': 1, 'answer': 1234 # Your answer; can be a float, int, list or array; # the challenge description will tell you which. } ``` To get a hint for a question, provide the question number but no answer: ``` params = { 'question': 1, } ``` [Complete instructions at kata.scienxlab.org](https://kata.scienxlab.org/challenge) [An example notebook to get you started](https://gist.github.com/kwinkunks/50f11dac6ab7ff8c3e6c7b34536501a2) ---- © 2024 [Scienxlab](https://scienxlab.org/) — Code: openly licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) — Text: openly licensed under [CC BY](https://creativecommons.org/licenses/by/4.0/).