[Question]
  [
My friend made a lisp translator the other day, that is to say it took a string and converted s=>th and S=>Th. It was quite long and I thought that it could be golfed.
So the task is to make a program/function that takes an input string, translates it in to lisp and outputs the string
**Test case**
```
Sam and Sally like Sheep        Tham and Thally like Thheep
Sally likes sausages            Thally liketh thauthageth
Sally sells seashells           Thally thellth theathhellth
```
Note that it doesn't matter that h gets repeated all the time
This is code golf so shortest answer wins
  
[Answer]
## Common Lithp, 62
```
(map()(lambda(u)(princ(case u(#\s"th")(#\S"Th")(t u))))(read))
```
First, `(read)` the input (it should be a string).
Strings in CL are sequences so we use `map` to iterate on each character. The first argument to `map` represents the type of the result (e.g. I could build a list from a vector). When it is `nil`, a.k.a. `()`, results are discarded. The function that is mapped to the input simply `princ` (print non-readably) each character, except the ones that should be replaced.
[Answer]
# Retina, 9 bytes
```
S
Th
s
th
```
[Try it online!](http://retina.tryitonline.net/#code=UwpUaApzCnRo&input=U2FtIGFuZCBTYWxseSBsaWtlIFNoZWVwClNhbGx5IGxpa2VzIHNhdXNhZ2VzClNhbGx5IHNlbGxzIHNlYXNoZWxscwpTaGUgc2VsbHMgc2VhIHNoZWxscyBvbiB0aGUgc2VhIHNob3Jl)
The obvious answer.
[Answer]
# JavaThcript ETh6, 38 bytes
At first I went with the obvious solution
```
a=>a.replace(/s/g,'th').replace(/S/g,'Th')
```
But I golfed it down 4 bytes
```
a=>a.replace(/s/gi,b=>b>'r'?'th':'Th')
```
This makes use of the regex `i` flag, which searches for case-insensitive patterns. The good thing about Javascript is that you can specify an anonymous function to handle (regex) replacing.
Try it here
```
f=
a=>a.replace(/s/gi,b=>b>'r'?'th':'Th')
s.innerHTML = [
    'abScdsefSghsij',
    'Sam and Sally like Sheep',
    'Sally likes sausages',
    'Sally sells seashells'
].map(c=>c + ' => ' + f(c)).join`<br>`
```
```
<pre id=s>
```
[Answer]
### GNU Sed - 17
```
s/S/Th/g;s/s/th/g
```
The obvious answer.
```
$ sed -e "s/S/Th/g;s/s/th/g"
Sam and Sally like Sheep
Tham and Thally like Thheep
Sally likes sausages
Thally liketh thauthageth
Sally sells seashells
Thally thellth theathhellth
```
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 13 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
“Ss”,“Th“th”y
```
Thhowing off Jelly'th thhiny new tranthlate atom. [Try it online!](http://jelly.tryitonline.net/#code=4oCcU3PigJ0s4oCcVGjigJx0aOKAnXk&input=&args=J1NhbGx5IGxpa2VzIHNhdXNhZ2VzJw)
[Answer]
# Python 3 - 40 byteth
First golfing!
```
lambda s:s.translate({115:'th',83:'Th'})
```
It uses the `str` module's [translate](https://docs.python.org/3/library/stdtypes.html?highlight=translate#str.translate) method which accepts a translation table. The translation table is a simple `dict` with keycode as keys and the `str` in place of it as value.
[Answer]
# JavaThcript ETh6, 43 byteth
```
s=>s.replace(/s/gi,m=>({s:'th',S:'Th'})[m])
```
## Tetht Thuite:
```
th=s=>s.replace(/s/gi,m=>({s:'th',S:'Th'})[m])
  
console.log(th('Sam and Sally like Sheep'));
console.log(th('Sally likes sausages'));
console.log(th('Sally sells seashells'));
```
[Answer]
# [V](https://github.com/DJMcMayhem/V), 11 byteth
```
Ís/th
ÍS/Th
```
[Try it online!](http://v.tryitonline.net/#code=w41zL3RoCsONUy9UaA&input=U2FtIGFuZCBTYWxseSBsaWtlIFNoZWVwICAgICAgICAKU2FsbHkgbGlrZXMgc2F1c2FnZXMgICAgICAgICAgICAKU2FsbHkgc2VsbHMgc2Vhc2hlbGxz)
V ith a language I made. It'th not finithed, but it'th really good at regekth.
[Answer]
## 05AB1E, ~~14~~ 12 bytes
```
's„th:'S„Th:
```
The straight forward answer.
[Try it online](http://05ab1e.tryitonline.net/#code=J3PigJ50aDonU-KAnlRoOg&input=U2FsbHkgbGlrZXMgc2F1c2FnZXM)
Saved 2 bytes thanks to @Adnan
[Answer]
# C, 50 bytes
```
s(c){c=getchar();c+=c-83&95?0:'h\1';s(printf(&c));}
```
Replace `\1` with an actual `\x01` byte.
jimmy23013 saved a byte, and then I saved two more using his approach! Thanks.
[Answer]
# Java, 71 65 bytes
```
String t(String s){return s.replace("S","Th").replace("s","th");}
```
First attempt at golfing, so why not with Java.
[Answer]
# GNU AWK, 31 bytes
Just using `gsub` function to translate lower or upper S via regex and print it afterwards. Can work with files, or with `stdin` as in this case
```
$ awk '{gsub(/s/,"th");gsub(/S/,"Th")}1' <<< "This is Sparta"                   
Thith ith Thparta
```
[Answer]
# TI-Basic, 126 bytes
```
Input Str1
inString(Str1,"s
While Ans
sub(Str1,1,Ans-1)+"th"+sub(Str1,Ans+1,length(Str1)-Ans->Str1
inString(Str1,"s
End
inString(Str1,"S
While Ans
sub(Str1,1,Ans-1)+"Th"+sub(Str1,Ans+1,length(Str1)-Ans->Str1
inString(Str1,"S
End
Str1
```
[Answer]
# Java, 101 byteth
```
interface a{static void main(String[]A){System.out.print(A[0].replace("S","Th").replace("s","th"));}}
```
Note that this is a complete program unlike [the previous Java answer](https://codegolf.stackexchange.com/a/83146/53917).
Bonus (has to be fed to the C preprocessor THEE preprothethor first):
```
#define interfaith interface
#define thtatic static
#define Thtring String
#define Thythtem System
#define replaith(x,y) replace(x,y)
interfaith a{thtatic void main(Thtring[]A){Thythtem.out.print(A[0].replaith("S","Th").replaith("s","th"));}}
```
[Answer]
# 35 Byteth of Julia:
```
s->replace(s,r"s"i,s->"$(s[1]+1)h")
```
[Try it online!](http://julia.tryitonline.net/#code=Zj1zLT5yZXBsYWNlKHMsciJzImkscy0-IiQoc1sxXSsxKWgiKQoKZm9yIHRlc3QgaW4gWygiU2FtIGFuZCBTYWxseSBsaWtlIFNoZWVwIiwgIlRoYW0gYW5kIFRoYWxseSBsaWtlIFRoaGVlcCIpLAogICAgICAgICAgICAgKCJTYWxseSBsaWtlcyBzYXVzYWdlcyIsICAgICAiVGhhbGx5IGxpa2V0aCB0aGF1dGhhZ2V0aCIpLAogICAgICAgICAgICAgKCJTYWxseSBzZWxscyBzZWFzaGVsbHMiLCAgICAiVGhhbGx5IHRoZWxsdGggdGhlYXRoaGVsbHRoIildCiAgICBwcmludGxuKGYodGVzdFsxXSkgPT0gdGVzdFsyXSkKZW5k&input=) (includes all test cases)
[Answer]
# C (GCC), 62 byteth
-10 bytes thanks to @ceilingcat; forgot to use the function argument as the iterator.
-1 more byte thanks to @l4m2 and his very smart recursion trick.
```
l(char*s){*s&&l(s+!!putchar(*s&31^19?*s:104+!putchar(*s+1)));}
```
[Try It Online!](https://tio.run/##S9ZNT07@/z9HIzkjsUirWLNaq1hNLUejWFtRsaC0BCSoARQxNowztLTXKrYyNDDRRpLQNtTU1LSu/Z@bmJmnoclVzaUABTkaSsGJpcWJ6akKOZnFBQrFQJCXmphdCWElZqcqaVpz1f4HAA)
Explanation:
```
l(char*s)
{
    // If at end of string, do nothing.
    *s&&
        // Else, apply this function to the next character in s ...
        l(s+
            // ... but first, print the current character. If the first
            // five bits of *s equal 19 (which they do for 's' and
            // 'S'), print *s+1 (that is, 't' for 's' and 'T' for 'S')
            // before printing character code 104, which is 'h'.
            // If the first five bits aren't 19, just print *s.
            !!putchar(*s&31^19?*s:104+!putchar(*s+1)));}
```
Alternative 62-byte version, made by l4m2:
```
l(char*s){*s&&l(s+!!printf(*s&31^19?"%c":*s%5?"Th":"th",*s));}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9HIzkjsUirWLNaq1hNLUejWFtRsaAoM68kTQMoYGwYZ2hpr6SarGSlVaxqaq8UkqFkpVSSoaQD1KFpXfs/NzEzT0OTq5pLAQpyNJSCE0uLE9NTFXIyiwsUioEgLzUxuxLCSsxOVdK05qr9DwA)
I'm too lazy to explain that one fully, but it's quite similar to the last one except it uses two nested conditional statements to figure out if it should print the current character, `Th` or `th`. The new `*s%5` check is used to figure out if `*s` is `'S'` or `'s'` (knowing that it's one of those), since the ASCII code of `s` is divisible by 5 but `'S'` is not.
[Answer]
## CJam, 15 bytes
```
q"sS""thTh"2/er
```
[Test it here.](http://cjam.aditsu.net/#code=q%22sS%22%22thTh%222%2Fer&input=Sam%20and%20Sally%20like%20Sheep%0ASally%20likes%20sausages%0ASally%20sells%20seashells)
### Explanation
```
q      e# Read input.
"sS"   e# Push string.
"thTh" e# Push string.
2/     e# Split into pairs, i.e. ["th" "Th"].
er     e# Transliteration, replaces 's' with 'th' and 'S' with 'Th'.
```
[Answer]
## Python3 - 46 bytes
```
lambda s:s.replace("s","th").replace("S","Th")
```
Dropped 4 bytes with the help of [@DenkerAffe](https://codegolf.stackexchange.com/users/49110/denkeraffe%20DenkerAffe)!
[Answer]
# Haskell, 36 bytes
```
f 's'="th";f 'S'="Th";f x=[x]
(>>=f)
```
[Answer]
# Rust, 46 bytes
```
|s:&str|s.replace("s","th").replace("S","Th");
```
[Try it online!](https://play.rust-lang.org/?gist=cf9cd30c67c57031c74f4c6ed5c5add5&version=stable&backtrace=0)
[Answer]
# PHP, 42 Bytes
if run from a file:
```
<?=strtr($argv[1],["s"=>"th","S"=>"Th"]);
```
Run as:
```
~$ php [file] "This is Silly"
```
[Answer]
# Emacth Lithp, 61 byteth
```
(lambda(s)(replace-regexp-in-string"[Ss]\\(\\w*\\)""th\\1"s))
```
Emacs Lisp tries to be smart when replacing text, but that smartness breaks when the replaced string only takes up one space, i.e. the capital letter S. To prevent this from converting "Sam and Sally" to "THam and THally", the whole word is matched instead. However, this also handles "SAM and Sally" in the way that one would want, i.e. producing "THAM and Thally".
[Answer]
# x86 machine code, 19 bytes
In hex:
```
86ac3c5374043c73750440aab068aa84c075eec3
```
Input: `ESI`: input string, `EDI`: output buffer.
Disassembly:
```
_loop:
0:  ac          lodsb       
1:  3c 53       cmp al,'S'  
3:  74 04       je _th      
5:  3c 73       cmp al,'s'  
7:  75 04       jne _nth    
_th:
9:  40          inc eax     ;[Ss]->[Tt]
a:  aa          stosb       
b:  b0 68       mov al,'h'  
_nth:
d:  aa          stosb       
e:  84 c0       test al,al  
10: 75 ee       jnz _loop   
12: c3          ret         
```
[Answer]
# Befunge 98, ~~37~~ 49 bytes
Original version : 
```
~:"s"- #v_$"ht",>,
_;#-"S":<;$"hT",^ 
```
---
Terminating edition, as per consensus : 
```
~:a-!#@_:"s"-#v_$"ht",>,
_;#-"S":      <;$"hT",^ 
```
This leaves a big honking hole in the code grid that I'm not very happy about. I'll look into that when I have the time.  
The 49th byte is a space at the end of the second line, included to have a rectangular grid, required to prevent ccbi (and probably other interpreters) from bugging out and printing an infinite line of "Th"s.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `s`, 11 bytes
```
ƛ⇩\s=[‛th$•
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJzIiwiIiwixpvih6lcXHM9W+KAm3RoJOKAoiIsIiIsIlNhbGx5IGxpa2VzIHNhdXNhZ2VzIl0=)
~~I wath hoping I could find thomething lethth trivial than jutht replacing the letter with the combo but I couldn't.~~ Lookth like I did.
## Explained
```
ƛ⇩\s=[‛th$•
ƛ             # To each character:
 ⇩\s=[        #   if char.lower == "s":
      ‛th$•   #     "th" with the capitalisation of the character
```
[Answer]
## **C# 6.0 - 58 bytes**
```
string f(string s)=>s.Replace("s","th").Replace("S","Th");
```
Takes the input string as an argument to the function.
[Answer]
# Pyth, 14 bytes
```
::z\s"th"\S"Th
```
[Test suite](http://pyth.herokuapp.com/?code=%3A%3Az%5Cs%22th%22%5CS%22Th&input=Sally+sells+seashells&test_suite=1&test_suite_input=Sam+and+Sally+like+Sheep%0ASally+likes+sausages%0ASally+sells+seashells+&debug=0)
Thanks to @LeakyNun for spotting a typo!
[Answer]
# [MATL](https://github.com/lmendo/MATL), 17 bytes
```
115'th'YX83'Th'YX
```
[**Try it online!**](http://matl.tryitonline.net/#code=MTE1J3RoJ1lYODMnVGgnWVg&input=J1NhbSBhbmQgU2FsbHkgbGlrZSBTaGVlcCc)
### Explanation
```
115    % 's' (ASCII)
'th'   % String 'th'
YX     % Regex replacement
83     % 'S' (ASCII)
'Th'   % String 'Th'
YX     % Regex replacement
```
[Answer]
# Python 3, 53 bytes
```
def l(s):return s.replace("s","th").replace("S","Th")
```
Usage:
```
>> l('Sam and Sally like Sheep')
Tham and Thally like Thheep
```
[Answer]
# GameMaker Language, 74 bytes
```
return string_replace_all(string_replace_all(argument0,'s','th'),'S','Th')
```
]