g | x | w | all
Bytes Lang Time Link
036Perl 5 + p240816T140242ZDom Hast
076Scala 3240818T123649Zuser
145Scala 3240818T025908Z138 Aspe
145TypeScript's type system240818T001506Znoodle p
038Uiua240817T185422ZjanMakos
018Jelly160607T045206ZDennis
078Python 2160607T055840ZDennis
058Ruby160607T202922ZValue In
071Python 3160607T195707ZDennis
081Python160607T044707ZKarl Nap
1816Pyth160607T131150ZFryAmThe
070JavaScript ES6160607T042440ZDowngoat
019CJam160607T055035ZMartin E
036Retina160607T081647ZMartin E
068Julia160607T053517ZDennis
046Vim160607T051144ZDJMcMayh
019Pyth160607T042524ZLeaky Nu

Perl 5 + -p, 36 bytes

%a=<>=~/(\S)(\S*)/g;s/./$&$a{lc$&}/g

Try it online!

Explanation

The hash %a is built using the first letter of each segment (from <>, STDIN) as the key and any remaining letters (0 or more) as the value. Then s///ubstitution is performed on $_ replacing each character in the string with itself ($&) followed by the value from the hash at (the lowercase) key in %a. $_ is then implicitly -printed.

Scala 3, 76 bytes

w=>_.map(c=>c+(w split " "find(_(0)==c.toLower)getOrElse "a").tail).mkString

Attempt This Online!

Based on this answer by 138 Aspen. Might be further golfable but I need to run now

Scala 3, 145 bytes

Golfed version. Attempt This Online!

(w,s)=>s.map(c=>(w+" "+w.split(" ").map(_.capitalize).mkString(" ")).split(" ").map(x=>x(0).toInt->x).toMap.getOrElse(c.toInt,c+"")).mkString("")

Ungolfed version. Attempt This Online!

object Main {
  def f(w: String, s: String): String = {
    // Create a translation map
    val translationMap = (w + " " + w.split(" ").map(_.capitalize).mkString(" "))
      .split(" ")
      .map(word => word.head.toInt -> word)
      .toMap

    // Translate the string s using the created map
    val translatedString = s.map(c => translationMap.getOrElse(c.toInt, c.toString)).mkString("")

    translatedString
  }

  def main(args: Array[String]): Unit = {
    val result = f("abra cadabra", (32 to 126).map(_.toChar).mkString)
    println(result)
  }
}

TypeScript's type system, 145 bytes

//@ts-ignore
type F<I,S,O="">=S extends`${infer C}${infer R}`?F<I,R,`${O}${C}${` ${I} `extends`${any} ${Lowercase<C>}${infer Z} ${any}`?Z:""}`>:O

Try it online: TypeScript Playground

This is a recursive generic type F<I, S> where I is a string-type representing the space-separated segments string, and S is the other string type. The //@ts-ignore comment is used to dismiss compiler errors.

Explanation:

The idea is to recursively loop through S, appending each character to a string O which begins empty and fills up with the final result.

Loop over the string S until it is empty by pattern-matching it against `${infer C}${infer R}` (which makes the first character C and the rest R) and recursing with F<I,R, ...> (keeping I the same and using R for the string). If the pattern-match fails because we have exhausted S, return the type parameter O which contains the result.

For the replacing logic, we attempt to pattern match ` ${I} ` (I surrounded by a space on both ends) against `${any} ${Lowercase<C>}${infer Z} ${any}` (which says match anything, a space, C converted to lowercase, some characters which are assigned to Z, another space, and anything). This effectively finds the suffix Z of the segment which starts with C. Then, Z—or nothing, if the match failed—is then appended to C and O.

Uiua, 38 bytes

Try it online!

/◇⊂⨬⋅∘(⊡⊙◌)⊸⊃∈(⊗:)⊙:⊙¤⊸≡◇⊢⊂⊸⍚⍜⊢⌵⊜□⊸≠@ 

This can probably be golfed more, but it's proving tough.

Explanation

                                ⊜□⊸≠@  # split at spaces
                          ⊂⊸⍚⍜⊢⌵ # join capitalized version
                      ⊸≡◇⊢ # get all first letters
           ⊸⊃∈(⊗:)⊙:⊙¤ # make mask of substitution positions a
                       # and indices of the replacements
   ⨬⋅∘(⊡⊙◌) # substitute character with replacement
/◇⊂ # join into final string

Jelly, 18 bytes

ṣ⁶;Œu1¦€$;©ZḢiЀị®

Try it online!

Alternative version, 15 bytes

Jelly's title case function had a bug; it didn't capitalize the first word. That has been fixed, so the following works now.

ṣ⁶;Œt$;©ZḢiЀị®

This code does the same as in the competing version, except that Œt (title case) replaces the conditional uppercasing achieved by Œu1¦€.

How it works

ṣ⁶;Œu1¦€$;©ZḢiЀị®  Main link. Left argument: w (words). Right argument: s (string)

ṣ⁶                  Split w at spaces.
        $           Combine the two links to the left into a monadic chain.
       €              Map over the words.
   Œu1¦                 Uppercase the item at index 1.
  ;                   Append the result to the unmodified words.
         ;          Append all characters in s to the list of words.
          ©         Copy the result to the register.
           Z        Zip/transpose, grouping the first chars into the first list.
            Ḣ       Head; extract the list of first characters.
             iЀ    Find the first index of each character in s.
                ị®  Select the characters/strings from the list in the register
                    that are at those indices.

Python 2, 83 78 bytes

lambda w,s:''.join(c+w[(' '+w).find(' '+c.lower()):].split()[0][1:]for c in s)

Test it on Ideone.

How it works

We iterate over all characters c in the string s.

We prepend a space to the string of words w, then search for a occurrence of lowercased c, preceded by a space.

Finally, ''.join concatenates all resulting strings, returning the Geobitsized version of s.

Ruby, 65 60 58 bytes

->w,s{s.gsub(/\w/){|c|w=~/\b#{c}(\w+)/i;c+($1||c)[1..-1]}}

Try it online!

Python 3, 71 bytes

lambda w,s:s.translate({ord(t[0]):t for t in(w+' '+w.title()).split()})

Test it on Ideone.

How it works

In Python 3, the built-in str.translate takes a string and a dictionary, and replaces each character in the string whose code point is a key of that dictionary with the corresponding value, which may be a string, an integer or None (equivalent to the empty string).

Converting the string of words w to title case (i.e., capitalizing the first letter of each word) and appending it to the result of w+' ' creates a string of space separated words with lower- and uppercase version (first letter). Without a second argument, str.split splits at whitespace, so (w+' '+w.title()).split() creates the list of all words.

Finally, the dictionary comprehension {ord(t[0]):t for t in...} turns each word t into a dictionary entry with key ord(t[0]) (code point of the first letter) and value t, so str.translate will perform the intended substitutions.

Python, 126 99 95 81 bytes

Alot thanks to Dennis:

lambda G,S,j=''.join:j(s+j(g[1:]for g in G.split()if g[0]==s.lower())for s in S)

Edit1: don't need to append to a temporary

Edit2: S may contain uppercase...

Edit3: don't duplicate G

Edit4: compressed a little bit more and shoved it into one line

Edit5: using unnamed lambda and j=join' '

Pyth, 18 16

MsXGhMJcjdrBH3)J

Try it here

Defines a function g that performs the geobitsising. As a program this would be a bit shorter if the second string is single line, but multiline input isn't worth it:

sXwhMJcjdrBz3)J

The general idea here was to title case the geobitsian string and append that to the original string. Then split that on spaces and for each string, take the first letter and map it to the string it represents. That way X will turn the first letter of each word into the full word.

JavaScript ES6, 67 63 70 bytes

g=>s=>s.replace(/\S/g,l=>l+(g.match(`\\b\\${l}(\\S+)`,'i')||[,""])[1])

Test this on Firefox. bugs are making this longer than I'd like

Explanation

function(gbarg, str) {
   return str.replace(/\S/g, function(chr) { // Replace non-whitespace w/...
        return chr + (
         gbarg.match(`\\b\\${l}(\\S+)`,'i')  // That word in the gbstr
        ||[,""])[1]                          // if not in gbstr, use blank str
   });
}

CJam, 19 bytes

lq\S/_32af.^+_:c\er

Test it here.

Explanation

l       e# Read first line of input (list of words).
q\      e# Read remaining input and swap with first line.
S/      e# Split around spaces.
_       e# Duplicate.
32af.^  e# Convert the first letter of each word to upper case by taking
        e# the element-wise XOR with the list [32].
+       e# Append the upper-cased words to the original ones.
_:c     e# Duplicate and convert each word to its first character.
\       e# Swap characters with words.
er      e# Transliteration, replacing each character with the corresponding word.

Retina, 36 bytes

Byte count assumes ISO 8859-1 encoding.

i`(?<=^.*\b\2(\w+)[^·]*?(\w))
$1
A1`

Try it online!

Julia, 72 68 bytes

w%s=prod(c->"$c"join((W=w|>split)[find(t->t[1]==c|' ',W)])[2:end],s)

Try it online!

Vim, 46 keystrokes

Ugly, and Hacky.

A <esc>:s/\<\w/:%s\/\0\\c\/\\0/g<cr>:s/ /eg<C-v><Cr>/g<cr>dgg@"

Pyth, 19 bytes

.rzsC_hMBsm,rd0rd3c

Try it online!