Skip to main content
Notice removed Reward existing answer by naffetS
Bounty Ended with Jonah's answer chosen by naffetS
Notice added Reward existing answer by naffetS
Bounty Started worth 100 reputation by naffetS
Became Hot Network Question
Tweeted twitter.com/StackCodeGolf/status/1546464320380436480
edited body
Source Link
pxeger
  • 25.3k
  • 4
  • 59
  • 146

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca baacbbccba                   ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx
yellow submarine time        YEET     YEllow submarinE Time

Rules

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca                    ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx
yellow submarine time        YEET     YEllow submarinE Time

Rules

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbccba                   ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx
yellow submarine time        YEET     YEllow submarinE Time

Rules

double letters
Source Link
pxeger
  • 25.3k
  • 4
  • 59
  • 146

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca                    ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx
yellow submarine time        YEET     YEllow submarinE Time

Rules

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca                    ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx

Rules

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca                    ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx
yellow submarine time        YEET     YEllow submarinE Time

Rules

Source Link
pxeger
  • 25.3k
  • 4
  • 59
  • 146

Backronymiser឵឵

Background

A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".

Challenge

Given a string a, and a word t, capitalise the correct letters of the words in a such that they spell out t. You should always move left-to-right through a, and capitalise the first occurrence of each letter.

For example, if a is all the worlds a stage, and t is LAG, then we walk along the letters of all the worlds a stage:

  • we look for the first l and capitalise it: aLl the worlds a stage
  • now we look for the next a, but it must be after the previously found l: aLl the worlds A stage
  • now we look for a g: aLl the worlds A staGe.

You may assume a will only contain lowercase ASCII letters and spaces.

You may assume t will only contain ASCII letters. You should choose whether t will be input in uppercase or lowercase.

You do not need to handle empty inputs or inputs that have no possible backronymisation.

Test cases

a                            t        output
================================================================
never gonna give you up      VIP      neVer gonna gIve you uP
all the worlds a stage       LAG      aLl the worlds A staGe
why                          WHY      WHY
baacbbcca                    ABC      bAacBbCcba
x                            X        X
xxxx                         X        Xxxx

Rules