[Question]
  [
Write a program that takes a single line string that you can assume will only contain the characters `/\_‾`. (That's forward and backward slash, underline and [overline](https://en.wikipedia.org/wiki/Overline). You can use `~` in place of overline if you need since overline is not convenient ASCII.)
For example, one possible input is:
```
__/‾‾\/\_/‾
```
Your program needs to output a truthy or falsy value depending on whether the left edge of the string is "connected", so to speak, to the right edge of the string via the lines of the characters. So, if the kerning was a bit less, there would be a solid black (albeit kinky) line all the way from the left edge to the right, like an unbroken piece of string or twine.
The output for the above example would be true because the edges are connected:
[![example path](https://i.stack.imgur.com/17nyk.png)](https://i.stack.imgur.com/17nyk.png)
To be clear on the connections:
* `/` connects on its bottom left and top right
* `\` connects on its top left and bottom right
* `_` connects on its bottom left and bottom right
* `‾` (or `~`) connects on its top left and top right
Also:
* It doesn't matter whether the edges of the string started on the top or the bottom, it only matters that they connect horizontally through the whole length of the string.
* You can assume the input string is non-empty, and of course just one line.
Here are some more examples followed by 1 (truthy) if they are connected or 0 (falsy) if not:
```
__/‾‾\/\_/‾
1
_
1
\
1
/
1
‾
1
___
1
\/
1
/\/
1
/\/\
1
‾‾‾
1
\\
0
‾‾
1
_‾
0
‾_
0
\_____/
1
\/\\/\\___
0
\/\__/‾‾\
1
______/\_____
1
‾‾‾‾‾‾\\_____
0
‾‾‾‾‾‾\______
1
_____/‾‾‾‾‾
1
\___/‾‾‾\___/‾‾‾
1
\_/_\_
0
\_/\_
1
/\/\/\/\/\/\/\/\/\/\/\/
1
____________________
1
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
1
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾/
0
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\
1
/\‾/\‾___/\_\/__\/\‾‾
0
```
The shortest code is the winner.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes
*-1 byte thanks to @EriktheOutgolfer*
Expect `~` instead of `‾`. Returns \$0\$ or \$1\$.
```
O*Ɲ:⁽8ƇḂẠ
```
[Try it online!](https://tio.run/##y0rNyan8/99f69hcq0eNey2OtT/c0fRw14L////Hx@vX1cXoxwApAA "Jelly – Try It Online"), [Truthy test suite](https://tio.run/##y0rNyan8/99f69hcq0eNey2OtT/c0fRw14L/D3dvOdz@qGnN///x8fp1dTH6MUCKK54rhkufC0jHA1n6XPoQHMNVV1cHxFwx8SCgzwVSDdbFFQ8RgUiAlAEBhBMPkdMHC4F16kPl9CECQE1gw7FAqLGoAGo6BsAlXhcDAA), [Falsy test suite](https://tio.run/##y0rNyan8/99f69hcq0eNey2OtT/c0fRw14L/D3dvOdz@qGnN//8xMVzxdVx18Vwx@jEgFB8fz1UHBmA2kBcTrx8fAxPEBPpc@jF1QARUqh8TH6MfD8QxdXUA)
Using this formula (but otherwise similar to the 11-byte version below):
$$n=\left\lfloor\frac{x^y}{15145}\right\rfloor$$
The transition is valid if \$n\$ is odd, or invalid if \$n\$ is even.
### Commented
```
O*Ɲ:⁽8ƇḂẠ     - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   :⁽8Ƈ       - integer division by 15145           -->  [23964828…8421, 59257069…0485]
       Ḃ      - least significant bit (i.e. parity) -->  [1, 1]
        Ạ     - all values equal to 1?              -->  1
```
---
# [Jelly](https://github.com/DennisMitchell/jelly), ~~14 12~~ 11 bytes
Supports (and expects) the `‾` character in the input string. Returns \$0\$ or \$1\$.
```
O*Ɲ%276%7ỊẠ
```
[Try it online!](https://tio.run/##y0rNyan8/99f69hcVSNzM1Xzh7u7Hu5a8P////h4/UcN@4AoRj8GzAQA "Jelly – Try It Online"), [Truthy test suite](https://tio.run/##y0rNyan8/99f69hcVSNzM1Xzh7u7Hu5a8P/h7i2H2x81rfn/Pz5e/1HDPiCK0Y8BM7niuWK49LnArHggW59LH4JjuCAKQTJQKiYeBPS5QHrh5nDFQ0QhkghNcASRiIeo00eTBJupj6JWH1kSaCzYMVgg1GJUgMV@MhB1TAH5BwA), [Falsy test suite](https://tio.run/##y0rNyan8/99f69hcVSNzM1Xzh7u7Hu5a8P/h7i2H2x81rfn/PyaGK/5Rwz4uII7nitGPAaH4@HgQHw2BxYEyMfH68THYFJCH9Ln0Y0AUiAAarx8TH6MfD8QxEGkA)
### How?
Given two consecutive characters of ASCII codes \$x\$ and \$y\$, we want a function that checks whether they form a valid transition.
We need a non-commutative operation, because the result may change when the characters are reversed. For instance, `_/` is valid but `/_` is not.
Using exponentiation, a possible formula1 is:
$$n=(x^y \bmod 276)\bmod 7$$
The transition is valid if \$n\le1\$, or invalid if \$n>1\$.
```
 chars |    x |    y | (x**y)%276 | %7 | valid
-------+------+------+------------+----+-------
   __  |   95 |   95 |      71    |  1 |  yes
   _/  |   95 |   47 |     119    |  0 |  yes
   _‾  |   95 | 8254 |     265    |  6 |   no
   _\  |   95 |   92 |     265    |  6 |   no
   /_  |   47 |   95 |      47    |  5 |   no
   //  |   47 |   47 |      47    |  5 |   no
   /‾  |   47 | 8254 |       1    |  1 |  yes
   /\  |   47 |   92 |       1    |  1 |  yes
   ‾_  | 8254 |   95 |     136    |  3 |   no
   ‾/  | 8254 |   47 |      88    |  4 |   no
   ‾‾  | 8254 | 8254 |     196    |  0 |  yes
   ‾\  | 8254 |   92 |     196    |  0 |  yes
   \_  |   92 |   95 |      92    |  1 |  yes
   \/  |   92 |   47 |      92    |  1 |  yes
   \‾  |   92 | 8254 |     184    |  2 |   no
   \\  |   92 |   92 |     184    |  2 |   no
```
*1. Found with a brute-force search in Node.js (using BigInts)*
### Commented
```
O*Ɲ%276%7ỊẠ   - main link, taking a string          e.g. "\_/"
O             - get ASCII codes                     -->  [92, 95, 47]
 *Ɲ           - exponentiation on all pairs         -->  [92**95, 95**47]
   %276       - modulo 276                          -->  [92, 119]
       %7     - modulo 7                            -->  [1, 0]
         Ị    - ≤1?                                 -->  [1, 1]
          Ạ   - all values equal to 1?              -->  1
```
[Answer]
# [Ruby -n](https://www.ruby-lang.org/), 30 bytes
```
p !/[_\\][\\‾]|[\/‾][_\/]/
```
[Try it online!](https://tio.run/##KypNqvz/v0BBUT86PiYmNjom5lHDvtia6Bh9EA0U04/V//8/Ph7EBaIY/RgwkysmhgvIBqH4@HgQE6GEC0IjI7Cq@Ph/@QUlmfl5xf918wA "Ruby – Try It Online")
Reduces all of the string-breaking sequences to two cases using Regex character classes.
[Answer]
# JavaScript (ES6), 45 bytes
The naive way.
```
s=>!/\/\/|\\\\|_~|~_|~\/|_\\|\/_|\\~/.test(s)
```
[Try it online!](https://tio.run/##rVNRasMwDP3PKbz8NIY1OkF6kbmIkDndRmhK7A0GwfRkO8wukklZ6tje6GDUEY5lP0nPkvxSv9WmGZ5PdnvsH/XUVpOpdneg6BsVjRHd6HB0pCJpCpC2HZRWG1sYOfFfVMKIaiea/mj6TpddfyjawpSDPnV1owv4PH/A4V5s3EZKmWUhLn@ww6t9et/nMpt95oiMJ1FEQs3KeuZXSvkl@FUExRC8YiBVAk/fcUMviUp8eEDomfc84zA8AxeDnxG8LAiMLSFBxQwgtoZfYRw7ueg1SZjH4wr/f8htvV3ynrRVW3cm6Cru5fWKCQmM67lMf9UtrS3nHMOk3@p6Ub@yPs9ceHqL/B4BceZ8Se/0BQ "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python](https://docs.python.org/3/), 46 bytes
```
f=lambda s:s==''or s[:2]in"__/~~\/\_"*f(s[1:])
```
[Try it online!](https://tio.run/##dU/RCoMwDHzPV4gv2r0EtzfBLzESHJtYcCrqGAPJr7vUytjYTBPa3iXHpX9OddeelqXKmvJ2vpTBmI5ZFkXdEIx5eixsGzKjCCFxeKjiMU/SwiyP2jbXIEn7wbZTXMW27e9TbIxZ3t0owECAoDfrCwF9EYiIFhC7QHDd6xSwRzzh2jT8hz2HK7RO4sahB3RoFf9zNtnv2NR/Yg9Xd6QGlXe7kMsPj5tjtcG0Ky1ufdF0rmfimZBZhURe "Python 3 – Try It Online")
Confirms that each adjacent pair of characters connects by checking that they appear consecutively in `__/~~\/\_`. This string can be viewed as a [De\_Bruijn\_sequence](https://en.wikipedia.org/wiki/De_Bruijn_sequence) on the \$2^3=8\$ triples of high/low positions.
I tried other less humdrum methods to check character pairs, but they were all longer that hardcoding all legal pairs like this .
[Answer]
# [R](https://www.r-project.org/), 89 87 81 78 bytes
-2 bytes thanks to @Giuseppe
-6 bytes thanks to @Nick Kennedy
-3 bytes replacing `1:length(y)` with `seq(a=y)`, where `a` is short for `along.with`
```
y=utf8ToInt(scan(,''));all(!diff(cumprod(c(1,y>93)*2-1)[seq(a=y)]*(y%%2*2-1)))
```
uses `\ / _ ~`. This is probably not as short as a regex based solution, but I fancied doing something a bit different to everyone else.
```
utf8ToInt('\\/_~')
# [1]  92  47  95 126
```
The characters less than 93 switch the state from up to down (or vice versa), and as such behave as `-1` while the others do nothing and behave as `1`, cumprod tracks the state with respect to the start. The even numbers are in an upstate (represented with `-1`), the odd numbers are in a down state (`1`). If the string is unbroken the tracked state multiplied with the up/down position, should not change, it will always be the starting condition (`-1`,or `1`)
[Try it online](https://tio.run/##PcpRC4IwFAXg9/5Fgniv6ER7KWq9995bC5HZBcG20gkOcX99UWJw4Bw@TueJ06CkabSCEadeVuqU/oUxhtM4e8sHQ/urvigD3wskUYR4rNoWtnVDBHJ4vjpdg4Q8sefDDuMizfHWP95QcYv3GGwYFj9E9POGIBAiwKXXVbpVsiXOOSHKMgvQfwA)
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 93 bytes
```
w,o,r;k(char*_){for(r=0;w=*_,o=*++_;)r|=w-126&&w>47?w-95&&w-92?0:o>47&&o-95:o-92&&o<126;_=r;}
```
[Try it online!](https://tio.run/##hVLRToMwFH3nK7BmpN1KyojTbNgRHzQx8cnMtybNxjZdFsG0Gh629dexBZSWJXpDL4dzbi/3FLLwNcuqqsQFFskeZm9LMeTosC0EFDRKSjrkuKDD0YgnSBxpGY7j6yAo51c3aRlOJxqG0ziNZoVmgqDQ1EynWMNbXZlwKpJTdbnebHf5xl9AiVfo8CF2@ecWgkEYT6Qfzv3B2k@pyXAgEcsBlngPJcIXq/pO6SoFD3ePTy/P92AG5FeWbaQEKDl53vtyl0N08BYQcE6UYowwpgHA3hh5Nd1BxjpMOmgXc6fcKiJnT3Y3pZS9r5aiH8lqryyed1iPbII47zZt6tQMFVlCa9WZ2@xv@zhzKVPZCZEr8N6Gpk8t2sO05C9wNMJ1csyQhnAO66@rb8SNvp2z@LdAkb7z83B@DsaUWcbtUXvRi3Bez6raT3iqvgE "C (gcc) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~29~~ ~~14~~ 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ÇümŽb‘÷ÈP
```
Port of [*@Arnauld*'s Jelly answer](https://codegolf.stackexchange.com/a/181718/52210), so make sure to upvote him as well!
Input with `‾`.
[Try it online](https://tio.run/##yy9OTMpM/f//cPvhPblH9yY9aphxePvhjoD//@Pj9R817AOiGP0YMBMA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3l/8Pth/fkHt2b9KhhxuHthzsC/uv8j4/Xf9SwD4hi9GPATK54rhgufS4wKx7I1ufSh@AYLohCkEwMjMMVDyKAGKgyHgT0gTpiQAiiOQZhPlc8RAFEHcIwOIrBKQOShOiGGKKPKQ@2Xh9dhz6yvH58DMiVQAeAvYMFQp2ICrC7h1REHVOASJ9qJgGjOQZkIIgAhVVNTHxNjH58fAxYBIgA).
---
### Original 29 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer:
```
„_~SD2×s:Çü-т+•6_üê{â†•ƵΔвåO_
```
Input with `~` instead of `‾`.
It sounded shorter in my head.. ~~Will try to golf it down from here.~~
[Try it online](https://tio.run/##yy9OTMpM/f//UcO8@LpgF6PD04utDrcf3qN7sUn7UcMis/jDew6vqj686FHDAiD32NZzUy5sOrw0IP7///h4/bq6GP0YIAUA) or [verify all test cases](https://tio.run/##dVCxCsIwEN3vK4qryoGDg0sXdwfXg0PBwcmhIBTLURx0F8FNpODiKLh1CziK/kJ@JF6aLkX7cuGSey/3jqyS2Xy5cNk6jTuR3R2iTpw6m59ZpuOBOSUjszdl/7Pt2rwYsinNbWMKm1/0@ny8ju@7uU7Y9RwzihCSJmAgQNDMekLAsAlEBMgnYAFRjj1QNeQjyCl0Ag5k0PinCmregiQosSpVLbHmMBSQyVtpp2qKP6v2aqI2@UFbXbCV0d8g0fAzZcQZIbP6inwB).
**Explanation:**"
```
„_~S                          # Push the characters ["_","~"]
    D2×                       # Duplicate it, and increase each to size 2: ["__","~~"]
       s:                     # Swap and replace all "__" with "_" and all "~~" with "~"
                              #  in the (implicit) input-string
         Ç                    # Convert the remaining characters to unicode values
          ü-                  # Calculate the difference between each pair
            т+                # Add 100 to each
              •6_üê{â†•       # Push compressed integer 1781179816800959
                       ƵΔ     # Push compressed integer 180
                         в    # Convert the larger integer to Base-180 as list: 
                              #  [52,66,69,100,103,131,179]
                          å   # Check for each if it's in the difference-list
                              # (1 if present; 0 if not)
                           O  # Sum the truthy values
                            _ # Check if this sum is exactly 0 (1 if 0; 0 otherwise)
                              # (and output this result implicitly)
```
[See this 05AB1E tip of mine (sections *How to comrpess large integers?* and *How to compress integer lists?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `•6_üê{â†•` is `1781179816800959`, `ƵΔ` is `180` and `•6_üê{â†•ƵΔв` is `[52,66,69,100,103,131,179]`.
**Additional explanation:**
There are 16 (\$2^4\$) possible pairs of characters we have to verify. If we convert each character to its unicode value, and calculate the differences, we would get [these differences](https://tio.run/##ASoA1f9vc2FiaWX//yIvXF9@IlNEw6NKROKCrMOHw4bigJrDuM6jzrh9dnks//8). Because compressed integer lists in 05AB1E has to have positive integers only, I [add 100 to each](https://tio.run/##ATMAzP9vc2FiaWX//yIvXF9@IlNEw6NKROKCrMOHw4bigJrDuM6jzrh9dnnOtU5p0YIrfX0s//8). The invalid pairs and their corresponding values are then: `["/_", 52]`; `["\~", 66]`, `["_~", 69]`, `["//", 100]`, `["\\", 100]`, `["_\", 103]`, `["~_", 131]`, `["~/", 179]`, which is why I have the compressed integer list in my code containing these values.  
Since `__` and `~~` will just like `//` and `\\` result in `0` (or `100` after I add 100), I first remove any adjacent duplicates of `~` and `_` in the input-string, before calculating and verifying the pair-differences.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~79~~ ~~70~~ 63 bytes
*Saved 16 bytes thanks to Arnauld and Jo King, thanks!*
```
p=lambda s:len(s)<2or((ord(s[-2])%13>5)^ord(s[-1])%2)&p(s[:-1])
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v8A2JzE3KSVRodgqJzVPo1jTxii/SEMjvyhFozha1yhWU9XQ2M5UMw4qYAgUMNJUKwCyrUCc/wVFmXklGgUaSvHx@o8a9gFRTIx@TAyYo6SpyYUkDwT6UDXICFWVPpD7HwA "Python 3 – Try It Online")
# [Python 3](https://docs.python.org/3/), ~~67~~ 60 bytes with ~ instead of ‾
```
p=lambda s:len(s)<2or(~(ord(s[-2])//7^ord(s[-1]))&p(s[:-1]))
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v8A2JzE3KSVRodgqJzVPo1jTxii/SKNOI78oRaM4WtcoVlNf3zwOyjOM1dRUKwCyrMDM/wVFmXklGgUaSvHx@nV1MTH6MTHx@o8a9ilpanIhyQGBPlC@Dij8HwA "Python 3 – Try It Online")
[Answer]
# [Chip](https://github.com/Phlarx/chip) `-z`, 17 bytes
```
FZ!C~aS
A}^]--^~t
```
[Try it online!](https://tio.run/##S87ILPj/3y1K0bkuMZjLsTYuVlc3rq7k///4eP26uhj9GCD1X7fqv24ZAA "Chip – Try It Online") (TIO includes `-v` to make it easier to understand the output.)
Expects the `_/~\` set. Returns either `\x00` (falsy) or `\x01` (truthy).
The strategy for my answer uses the following information:
```
Symbol  Binary
   _    0101 1111
   /    0010 1111
   ~    0111 1110
   \    0101 1100
          ^   ^ ^
        HGFE DCBA
```
`A`: This bit position happens to be `1` when the left side of the symbol is low, and `0` when it is high  
`F`: This bit position happens to be `0` when the right side of the symbol is low, and `1` when it is high  
`C`: This bit position happens to always be `1`
Using this information, I simply need to check that the `F` of each character matches the `not A` of the next. An `xor` gate is a convenient way to accomplish this.
The following code does this, but gives output for each pairing (plus an extra `1` at the start) (7 bytes):
```
FZ!
A}a
```
We want to halt at the first failure, and also print whether we have halted within the string, or at the null terminator (we also add `-z` to give us a null terminator). We can use `not C` to signify where we stopped, and that gives us this program (13 bytes):
```
FZ!C~a
A}^]~t
```
But we still have "leading zeroes" (e.g. `\_/\` gives `00 00 00 00 01`), so this is transformed to the answer given at the top.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~13 12~~ 11 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
O*Ɲ%⁽wḃ%5ỊẠ
```
A monadic Link accepting a list of characters, uses the `~` in place of `‾` option.
**[Try it online!](https://tio.run/##y0rNyan8/99f69hc1UeNe8sf7mhWNX24u@vhrgX///@Pj9evq4vRjwFSAA "Jelly – Try It Online")** Or see a [test-suite](https://tio.run/##fU87CgJBDO1zj21sUnkOLxB41TayvQhLQC0WvIPgASwtxMVK8B6zFxmTySCInzcTMvNe8kiWbdetc17MHodm2txW6bJr5mncp@sxp/F8H6btKWeAVYXFEoGEmCzDXkwcIaSqFiRwMHl16SIEE4KXGeKD0LhQpZOrxkFYUzH/cqrtO6r7B37xNp3YgKb7LuK3rAWGvEaVv9bq66tdn7oX9MKAGak@AQ "Jelly – Try It Online") (...where I've reordered to place the 8 falsey ones at the end)
This formula was found by fiddling around by hand :p (as were those below)
For this one I too all 16 pairs of character's ordinals treated as an exponentiation and looked for a large modulo that will fit into three bytes followed by a one-byte modulo (1,2,3,4,5,6,7,8,9,10,16,256) that partitioned the 16 such that all of the acceptable results were either 1 or 0 ("insignificant") since I know `Ị` is shorter than `<5`, in my previous solution, which was looking for all acceptable results being less than all unacceptable ones.
```
O*Ɲ%⁽wḃ%5ỊẠ - Link: list of characters
O           - ordinals
  Ɲ         - for each pair of neighbours:
 *          -   exponentiate
    ⁽wḃ     - 30982
   %        - modulo (vectorises)
        5   - five
       %    - modulo (vectorises)
         Ị  - insignificant? (abs(x) <=1) (vectorises)
          Ạ - all truthy?
```
The possible neighbouring characters and their internal evaluations:
```
(Ɲ)         (O)            (*%⁽wḃ)        (%5)      (Ị)
pair   a,b=ordinals   c=exp(a,b)%30982   d=c%5   abs(d)<=1
__       95,  95         28471             1         1
_/       95,  47         29591             1         1
/~       47, 126         19335             0         1
/\       47,  92          9755             0         1
~~      126, 126         28000             0         1
~\      126,  92         26740             0         1
\_       92,  95          9220             0         1
\/       92,  47         13280             0         1
~_      126,  95          3024             4         0
~/      126,  47         12698             3         0
\~       92, 126         27084             4         0
\\       92,  92         17088             3         0
_~       95, 126         28169             4         0
_\       95,  92          4993             3         0
/_       47,  95         22767             2         0
//       47,  47          7857             2         0
```
---
Previous @ 12:
```
O*Ɲ%⁽?K%⁴<8Ạ
```
[Try it online!](https://tio.run/##y0rNyan8/99f69hc1UeNe@29geQWG4uHuxb8//8/Pl6/ri5GPwZIAQA "Jelly – Try It Online")
---
Previous @ 13:
```
O%7ḅ6$Ɲ%⁵%8ỊẠ
```
[Try it online!](https://tio.run/##y0rNyan8/99f1fzhjlYzlWNzVR81blW1eLi76@GuBf///4@P16@ri9GPAVIA "Jelly – Try It Online")
[Answer]
# Python 3, 126 bytes
```
lambda s,d={'‾':'\‾','_':'/_','/':'\‾','\\':'/_'}:len(s)<2or all([s[i+1] in d[s[i]]for i in range(len(s)-1)if s[i]in d])
```
[Answer]
# [Haskell](https://www.haskell.org/), 70 bytes
This variant uses `~` instead of overlines. It takes all eight valid pairs and checks whether the string only contains those:
```
f(a:b:x)=[a,b]`elem`words"__ _/ /~ ~~ ~\\ \\_ \\/ /\\"&&f(b:x)
f _=1>0
```
[Try it online!](https://tio.run/##dU5BboNADLz7FSNURaC0dXtFIh@pK2fTgoIKpAqpwslfp16WS9Rm1pZ3Z8b2HsP4VXfdPDd5KA/lVFRv4fHwvq@7ut9fT@fPMVOFMthgHiIQUU9nRLLNpsljFzXQ6nX3MvehHVChHS71OXxc8ICfoWuHesQz@vCNXCY87TBhu0VWIot1PJ6uyBtMReGuxT2rspmweCElISav6jcmTilkZiSxkBqZaxrB7pEYyS5pEmkSkye2OuT2lSzJyQu1jORV40SwSlzlk5Zf/HPWXbdYl/zBPd74riK/ "Haskell – Try It Online")
Ungolfed:
```
validate :: String -> Bool
validate xs = all valid $ zip xs (tail xs)
  where
    valid (a,b) = [a,b] `elem` starts
    starts      = words "__ _/ /~ ~~ ~\\ \\_ \\/ /\\"
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 32 bytes
```
{!/< \\\ \~ ~/ // _~ ~_ _\ /_>/}
```
[Try it online!](https://tio.run/##rVDLCsJAEDu7XxEvbgvV0YsXbb8kMFSxIPii9VLU4pf5Mf5I3W1BsPYkzoYhO4HMkNMm383rfYlRhhj1ZShLkAQrVAIRqCMKJUQTudXZMUew2x42RYhxAqYRuIqtjbh2HRczKNISWZBOznl6KAL7vD9snNjKhmEEiziBjYDVwtxqJ3VAqi8zNaZH1FacGdMQ6ehe4Mf889fqomz8HWPjJex97zWd8vPv237A34wcpD@x38A2FW/rm8/wSr1SVNlM/PHTFw "Perl 6 – Try It Online")
A regex solution that simply checks that the string contains no invalid sequences.
### Explanation:
```
{                              }   # Anonymous code block
  /<                         >/    # Find the longest sequence from
     \\\                           # \\
         \~                        # \‾
            ~/                     # ‾/
               //                  # //
                  _~               # _‾
                     ~_            # ‾_
                        _\         # _\
                           /_      # /_
 !                                 # And logically negate the match
```
[Answer]
# perl 5, ~~26~~ 25 bytes
using `;` as delimiter the end delimiter can be removed
```
$_=!m;[/~][_/]|[\\_][~\\]
```
[TIO](https://tio.run/##K0gtyjH9/18l3lYx1zpavy42Ol4/tiY6JiY@NrouJib2//86MAAKgAAXlBcP4YFJfbAQVwyUCaOBAvrxMfEgCkjqx2CFEBPQABfUFgyAS7xOH6dMDNDmRw37wATIYTUx8TUx@vHxMWARIPqXX1CSmZ9X/F@3IAcA)
[26 bytes](https://tio.run/##K0gtyjH9/18l3lYxVydavy42Ol4/tiY6JiY@FkjUxer8/18HBkAREOCC8uIhPDCpDxbiioEyYTRQQD8@Jh5EAUn9GKwQYgIa4ILaggFwidfp45SJAdr8qGEfmAA5rCYmviZGPz4@BiwCRP/yC0oy8/OK/@sW5AAA)
[Answer]
# [R](https://www.r-project.org/), 43 chars, 47 bytes
It's the same regex the other answers use, but adapted for R.
```
!grepl('[/‾][/_]|[\\\\_][\\\\‾]',scan(,''))
```
[Try it online!](https://tio.run/##K/r/XzG9KLUgR0M9Wv9Rw77YaP342JroGCCIjwVTIEF1neLkxDwNHXV1Tc3/MfH6MSCl/wE "R – Try It Online")
And obligatory [xkcd](https://www.xkcd.com/1638/). 
[Answer]
# [Forth (gforth)](http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/), 100 98 bytes
```
: x = swap '~ = + ;
: f 1 tuck ?do over i + >r i 1- c@ r> c@ dup 92 x swap dup 47 x <> + loop 0> ;
```
[Try it online!](https://tio.run/##bU9dT4QwEHz3V0x48cFw9dDEeGj1hzRpLhyo0aRN4fx46V/H3UI/SK4QZjuzM7sMxk3v9dvAMM8H/OIZ48/R4tpTdYMWBwzYYzp3n3g5GZjv3uGDFMmwr9G9wkn@ns4Wjw0lBD/f7h/o9iSp@csYi1uJdlYUaNGwPP3ZHs3dElljtMeuH7GrgFqiCmN3Dp1De7X1EJXFoI8VtBbeK6EIKtjArKhWFCsmXaeOKImyij7vo0NlKmbEwqcszUekZMVvOUotm@YluH1x5YF01CVOl9xiDUIxXKx9oqSFVnlBkWr@ywvPZrftIWn@Bw "Forth (gforth) – Try It Online")
### Explanation
Go through the string and determine whether each character starts on the same position (top or bottom) as the one before ends. Subtract 1 from a counter if they don't match. At the end, if the counter has changed, then the string is not a string.
End position is high if char is `/` (47) or `~` (126). Otherwise it's low
Start Position is high if char is `\` (92) or `~` (126). Otherwise it's low
### Code Explanation
```
\ x is basically just extracting some common logic out into a function to save a few bytes
\ it checks if the first number is equal to the second number
\ or the third number is equal to 126   
: x                \ start a new word definition
  = swap           \ check if the first two numbers are equal then swap with the third
  '~ =             \ checks if the third number is equal to 126
  +                \ adds results together (cheaper version of or)
;                  \ end the word definition
: f                \ start a new word definition
  1 tuck           \ set up parameters for a loop (and create a bool/counter)
  ?do              \ start counted loop from 1 to string-length -1, 
                   \ ?do will skip if loop start and end are the same
    over i +       \ copy the string address and add the loop index to get the char address
    >r i           \ place char address on return stack and place a copy back on the stack
    1- c@          \ subtract 1 to get previous char address and grab ascii from memory
    r> c@          \ move char address back from return stack, then grab from memory
    dup 92 x       \ get the "output" position of the prev character
    swap dup 47 x  \ get the input position of the current character
    <> +           \ check if they aren't equal and add the result to the counter
                   \ the counter won't change if they're equal
  loop             \ end the loop
  0>               \ check if counter is less than 1 (any of the "links" was not valid)
;                  \ end word definition
```
[Answer]
# Haskell, 42 bytes
```
g=tail>>=zip
h=all(`elem`g"__/~~\\/\\_").g
```
this solution uses `~`, and the function to call is h (i.e., `h string` gives the answer)
The solution uses a function g that given a list, returns all tuples of adjacent values on the list.
Then we use g to generate the list of allowed neighbors (in `g"__/~~\\/\\_"`) and also the list of all neighboring pairs in the input list. Then we check that each neighboring pair is an allowed pair.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~41~~ 36 bytes
```
f(char*_){_=!_[1]||*_/32+*++_&f(_);}
```
[Try it online!](https://tio.run/##fVHLboMwELz7KyhSIhsTbZsoJ0p/JEaryJUbH0Iimhthf536RUjVipUZL7OzD9t686X1OBquT8euQNFj/YKHt@Z@LxB2W1lIiWvDUVTDeD7aloueBWl204em7lmOCERKgVLOyUtHeFDKI3iIJCY6UPC0RyURxfj0G5ICUspEb5CqeGGAubD3wyipn1enrNSBfPQfCh9MzAr0oylMGphZQAeTn9x4mKU1D/bb5ln@2EKIYCmYHkAp8l@6CzcDYpjFVR4qxsyl47a9ZbZ@rez7zoGUgl07xxmer7b772zzka0@VZuX7sFtUxoediEqNow/ "C (gcc) – Try It Online")
-5 eliminated `&1` starting off from an idea from [Peter Cordes](https://codegolf.stackexchange.com/questions/181708/would-this-string-work-as-string/181842?noredirect=1#comment437944_181842); changed operators (precedence) to remove parentheses
---
Uses `~`. Checks the first and sixth bits of the first two characters' binary representations:
```
_ 1011111
\ 1011100
/  101111
~ 1111110
   ^    ^
```
and traverses the string recursively.
`(*_ / 32) & 1` is true only for chars that end high, while `*_ & 1` is true only for chars that start low. `(x&1) ^ (y&1) == (x+y)&1`. XOR is add-without-carry, and carry doesn't disturb the lowest bit. The `1` comes from the `f(_)` return value, if the rest of the string was stringy.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~80~~ 78 bytes
I don't realy do many python code golfs but I thought I could give it a try
* -2 bytes: realised not(any()) is the same as all(not()) and could move the not into the r-string
```
def f(x):*l,=map(r'_/\~'.find,x);return 1-any((i^j//2)%2for i,j in zip(l,l[1:]))
```
[Try it online!](https://tio.run/##dVDBbsMgDD3XX8FlAiY0a90tU/5it3mzKjVRqWiKUKJlU8WvdybkUm19GD14ftgW8Xs8nIeX63Xf9ao3s20eg2tPu2iSpsyon3o/7N1sX1M3TmlQuxCM8Z9HxK192PbnpLw7Kj@oHx9NcOH9ufmw9vp18KFTb2nqGthE1YojTqOxsPG9knurdDd7EXRTWVzJD6OJTulGO5klShlmzJmQhICBAEGY5YSAdRPknIEKAWfIkuMCFA@VqHaqlYBrsnrKUwHd3qqlOnGRlpK45rAKyFRaSaVlin/W2usWa5M/uKdnvJuR36AsUWa6EF8ImaVvzr8 "Python 3 – Try It Online")
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 71 bytes
I wanted to try out the new `:=` expression assignment
```
lambda x:all((i^j//2)%2for i,j in zip(l:=[*map(r'\~_/'.find,x)],l[1:]))
```
[Try it online!](https://tio.run/##dVBNa8MwDD1Pv8KXEXuEiXWXEci/2K3qREYb6uKmxqSsG0V/PZPjXMrWZxlZek8fOH6P@9Pw@hbT1Lc0he74ue3MpelCsNZ/HBBX7nHVn5Lx9cH4wfz4aEPTrp@OXbSpImGsnns/bOuL29Rh/dJsnJu@9j7szHs67xp4iKbVyngerdMg@WG0sTZVU9Wmt1HVzChCSOqAgQBBPesLAcslEBGg7IAFRDnOQNVQtiKn0gm4kEWTSxV0GxVJUeKcmlviwmFJIFMepZ3mLf45y6xbLEP@4F5e8C6jv0Gilne6El8JmXWuyC8 "Python 3.8 (pre-release) – Try It Online")
[Answer]
# Bash, 30 bytes
```
grep -E '//|\\\\|_~|~_|~/|_\\|/_|\\~'
```
Input is STDIN. Exit code is 1 if valid, 0 if invalid.
[Answer]
# Excel, 150 bytes
```
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"_\",),"_‾",),"‾_",),"‾/",),"/_",),"//",),"\‾",),"\\",)=A1
```
Removes any invalid pairs, then return `true` if this results in the original string.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 24 bytes
```
C`[_\\][\\~]|[~/][_/]
^0
```
[Try it online!](https://tio.run/##K0otycxLNPz/3zkhOj4mJjY6JqYutia6Tj82Ol4/livO4P//@Hj9uroY/RggBQA "Retina – Try It Online")
Uses `~` rather than `‾`, because that made it easier to type.
* -2 bytes by removing some unnecessary backslashes (thanks to @Neil)
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), 58 bytes
```
	INPUT '/_' | '_\' | '\\' | '//' | '~/' | '\~' @OUTPUT
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/n9PTLyA0REFdP15doUZBPT4GTMVAKH19MFUHoWLq1BUc/ENDgOq5XP1c/v@Pj9evq4vRjwFSAA "SNOBOL4 (CSNOBOL4) – Try It Online")
Outputs nothing for truthy and a positive integer (indicating the position of the first break in the string) for falsy.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~32~~ 18 bytes
```
⌊⭆θ∨¬κ⁼№_/ι№\_§θ⊖κ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM3My8ztzRXI7gEyE33TSzQKNRR8C/S8Msv0cjW1FFwLSxNzCnWcM4vBSpWitdX0lHIBApD@TEx8UABxxLPvJTUCpBOl9TkotTc1LyS1BSgdiiw/v8/Pl7/UcM@IIrRjwEz/@uW5QAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
  θ                 Input string
 ⭆                  Map over characters and convert to string
     κ              Current index
    ¬               Logical Not (i.e. is zero)
   ∨                Logical Or
          ι         Current character
       №            Count (i.e. contained in)
        _/          Literal _/ (i.e. begins at bottom)
      ⁼             Equals
               θ    Input string
              §     Indexed by
                 κ  Current index
                ⊖   Decremented (i.e. previous character)
           №        Count (i.e. contained in)
            \_      Literal \_ (i.e. ended at bottom)
⌊                   Minimum (i.e. if all true)
                    Implicitly print
```
[Answer]
# Regex, 34 bytes
I couldn't find rules on using Regex as a language. Please let me know if I need to adjust this.
```
^(‾+|(‾*\\)?(_*\/‾*\\)*_*(\/‾*)?)$
```
Try it here: <https://regex101.com/r/s9kyPm/1/tests>
[Answer]
# x86 machine code, 13 bytes.
(Or 11 bytes without handling single-character strings that are trivially stringy.)
Uses the bit-position check from [@attinat's C answer](https://codegolf.stackexchange.com/questions/181708/would-this-string-work-as-string/181842#181842)
Same machine code works in 16, 32, and 64-bit modes. The source is NASM for 64-bit mode.
```
nasm -felf64 -l/dev/stdout  listing
    17   addr                  global string_connected
    18           code          string_connected:
    19           bytes         ;;; input: char *RSI, transitions to check=RCX
    20                         ;;; output: AL=non-zero => connected.  AL=zero disconnected
    21                         .loop:                      ; do {
    22 00000000 AC                 lodsb                   ;   al = *p++
    23 00000001 E309               jrcxz  .early_exit        ; transitions=0 special case.  Checking before the loop would require extra code to set AL.
    24 00000003 C0E805             shr    al, 5
    25 00000006 3206               xor    al, [rsi]          ; compare with next char
    26 00000008 2401               and    al, 1
    27 0000000A E0F4               loopne .loop            ; }while(--rcx && al&1);
    28                         .early_exit:
    29 0000000C C3                 ret
```
Callable from C as **`unsigned char string_connected(int dummy_rdi, const char *s, int dummy_rdx, size_t transitions);`** with the x86-64 System V calling convention. Not `bool` because the transitions=0 case returns an ASCII code, not 1.
`RCX = len = strlen(s) - 1`. i.e. the number of character-boundaries = transitions to check in the explicit-length string.
For `transitions > 0`, returns 0 (mismatch) or 1 (connected) and leaves ZF set accordingly. For `transitions == 0`, returns the single byte of the string (which is non-zero and thus also truthy). **If not for that special case, we could drop the early-exit JRCXZ.** It's inside the loop only because AL is non-zero there.
---
The bit-position logic is based on the observation that bit 0 of the ASCII code tells you the starting height, and bit 5 tells you the ending height.
```
;;;  _ 1011111
;;;  \ 1011100
;;;  /  101111
;;;  ~ 1111110
;;;     ^    ^
    ; end condition (c>>5) & 1 =>  0 = low
    ; start cond: c&1 => 0 = high
    ; (prev>>5)&1 == curr&1  means we have a discontinuity
    ; ((prev>>5) ^ curr) & 1 == 0  means we have a discontinuity
```
Test harness (modified from attinat's TIO link, beware the C sequence-point UB in that C reference function). [Try it online!](https://tio.run/##fVLtTsIwFP3NnuI6A9mgWNH4RwQfxGJDugJNWDFrl/hFXx1v123UaGi6fpxz77l32xHTrRCn0@laabGvCwlPxlZKb292yyTGCnXwUFJro7ZaFiB26wpCLBcHraWwssiUtlDUZfnBq0IRQMLYEDp@IxCz7wSM@pTcwl7qfJ4kntxk54wxz78qaetKwxV/ma2@v8d8uXwYzV7HkwkfzUajTcbz@TFklmuls/wrGUQCbXkrXlYLZAYp59Q5xihjeEhJA4WNsbDTsHUk7@mWoL9OXZZzros7Q61Eu7teiftBe12f0ixxMX9rWu378Dltbl/T@Yh/QR5hIbchohZoF0djnHJczrf@El720owb/T3izv6Mi6Sjl@n@pzHm/NN@I@yG86Yr1D@iswabQ9U4Uy1u5@rpHpfJJAdvCY9aiSZZoPfQKGqFVgzw2pS8kqbee/KP0W8JNOEE8IQsmrjNhynMGpHY/KUy5dqKHUqFcotY/xnSFB4h7aJSn/6GFe0mS4d3DwamSxgWOJlldmiYTklb3auRSItAJ@J7OCbH5PQD "C (gcc) – Try It Online"). This function is correct for all 30 cases. (Including the single-character cases where the return value doesn't match: both are truthy with different non-zero values in that case.)
[Answer]
# Excel, 79 bytes
Cell `A1` as input
```
=1---SUMPRODUCT(--ISNUMBER(FIND({"//","/_","\~","\\","~/","~_","_\","_~"},A1)))
```
[Answer]
# [naz](https://github.com/sporeball/naz), 142 bytes
```
2a2x1v4a8m1s2x2v2m2s2x3v3a2x4v3d4m2a2x5v1x1f1r3x2v2e3x3v3e3x4v3e2f0x1x2f1r3x1v4e3x3v3e3x5v2e0m1o0x1x3f1r3x1v4e3x2v2e3x4v3e0m1o0x1x4f0m1a1o0x1f
```
Another answer with a lot of conditionals - so many, in fact, that halfway through writing the explanation for a 206-byte solution, I realized an optimization I could make to achieve this one.
Works for any input string terminated with the control character STX (U+0002). `~` is expected instead of `‾`.
**Explanation** (with `0x` commands removed)
```
2a2x1v                       # Set variable 1 equal to 2
4a8m1s2x2v                   # Set variable 2 equal to 47 ("/")
2m2s2x3v                     # Set variable 3 equal to 92 ("\")
3a2x4v                       # Set variable 4 equal to 95 ("_")
3d4m2a2x5v                   # Set variable 5 equal to 126 ("~")
1x1f                         # Function 1
    1r                       # Read a byte of input
      3x2v2e                 # Jump to function 2 if it equals variable 2
            3x3v3e3x4v3e     # Jump to function 3 if it equals variable 3 or variable 4
                        2f   # Otherwise, jump to function 2
1x2f                         # Function 2
    1r                       # Read a byte of input
      3x1v4e                 # Jump to function 4 if it equals variable 1
            3x3v3e           # Jump to function 3 if it equals variable 3
                  3x5v2e     # Jump back to the start of the function if it equals variable 5
                        0m1o # Otherwise, output 0
1x3f                         # Function 3
    1r                       # Read a byte of input
      3x1v4e                 # Jump to function 4 if it equals variable 1
            3x2v2e           # Jump to function 2 if it equals variable 2
                  3x4v3e     # Jump back to the start of the function if it equals variable 4
                        0m1o # Otherwise, output 0
1x4f0m1a1o                   # Function 4
                             # Output 1
1f                           # Call function 1
```
[Answer]
# [Dart](https://www.dartlang.org/), 94 bytes
```
f(s)=>!(r'//,\\,~/,_\,~_,_~,/_,\~'.split(',').map((t)=>s.contains(t)).fold(false,(p,e)=>p|e));
```
[Try it online!](https://tio.run/##tVPvaoMwEP/uU6RQSKTBdJ@l@7an8MoRrK5ltkp0Y7C27Mn2MHsRd4ldaVJHobB4RO93v/sbs9Km6/tStPHicSIMV0oCyKOSSDtKPEqFEo48aZtq0wkueZxsdSNERw5tkte7Tm92LalxUtbVSpS6agspGlkQodkXcZz2b9qwXLdFyxYsixjLDEdU359fJKDAfXLZmddiKa2Z46VmOHDJLqzKVxHRA4ivAkBZJADAR4ZqgkIoFNFcSz7PJ6FDQhoGEKBdQSFUhxXXg8@muZxnFKQbAg3x/ujiLPBLG@nC4@FIuCFRwAwa8Bi@FjIVwvVQFOD12Yw8YzPw161R3CH/EJJE3TyN@wTCQdpcdrOnsgfcg0IEh1z/sSffaJlG0ZbutIg/yLDZdax@oXs7T0/aVr@T6q5zUhW7525tLYNe1uZJ52shcudMDqUoRZ7NlzGbkFP2QB@NoTADmDpSQVVQktnMqgcC6TWQ@JRyKzalnJzwQ/8D "Dart – Try It Online")
[Answer]
# APL+WIN, 58 bytes
m←2 2⊤'\_/\~'⍳s←,⎕⋄(1+⍴s)=+/((↑m[0;]),m[1;])=m[0;],¯1↑m[1;]
Prompts for input of string, index origin 0 and uses ~ for upper character
[Try it online! Courtesy of Dyalog Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcQJanP5BlwPWooz3tfy6QaaRg9KhriXq8fkyd@qPezcVAIR2gskfdLRqG2o96txRr2mrra2g8apuYG21gHaupkxttCKRswTydQ@sNwTJAof9AI/@ncanrqwMA "APL (Dyalog Classic) – Try It Online")
]