Questions tagged [string]

A competition to solve a particular problem through the usage and manipulation of strings.

24
votes
12answers
902 views

Primenary Strings

A Primenary (binary-prime) string is one which, when written as a binary grid, every row and column has a prime total. That's quite a vague explanation, so let's break it down with a worked example.....
33
votes
38answers
3k views

Generate the Abacaba sequence

This challenge is about printing the abacaba sequence of a specific depth. Here is a diagram of the first 5 sequences (a(N) is the abacaba sequence of depth N, ...
9
votes
24answers
4k views

Count All Possible Unique Combinations of Letters in a Word

You are given a string, which will contain ordinary a-z characters. (You can assume this will always be the case in any test, and assume that all letters will be lowercase as well). You must ...
57
votes
11answers
8k views

New Site Design!

Unless you have a userscript that modifies the site's design (or even if so), you should have noticed that we have our site design! (It's November now) So, to celebrate, let's make a program that ...
12
votes
7answers
309 views

Print the total length of all “quoted” characters

Rules In this challenge, I'm going to redefine the definition of "quotes" a bit. Quotation marks (AKA quotes) are any identical characters used in pairs in various writing systems to set off direct ...
31
votes
17answers
3k views

Who is the sleepiest of them all?

Write a program or function that takes in a string of the characters -=o. where the -=o's and ...
-3
votes
0answers
148 views

Hello Random World? [closed]

Write a program that outputs each character of the string "Hello Random World" with a one second interval, and each character should be randomly generated within [a-A z-Z] range (any lower/upper ...
19
votes
18answers
3k views

Create a simple line editor

In: a string without line breaks* Allow the user to edit and submit the line Out: the modified string (optionally with a trailing linebreak) The line editor must at minimum allow the user to: move a ...
89
votes
79answers
9k views

Unique is Cheap

Write a function or program that determines the cost of a given string, where the cost of each character equals the number of how many times the character has occurred up to this point in the string,...
25
votes
38answers
3k views

Is my name official?

Introduction As ToonAlfrink says: "Me thinks there aren't enough easy questions on here that beginners can attempt!". So the task is very simple. Given a string, output a truthy or falsy value ...
45
votes
43answers
12k views

Print “N NE E SE S SW W NW”

This seems almost trivial, but since after some effort I was not able to beat the literal solution in J, I thought it might make a decent challenge (though, to be clear, this is not a J-specific ...
22
votes
26answers
2k views

Close-Knit Words

Introduction According to Rand Al'Thor's post in the Puzzling SE, a close-knit word is any word that contains three alphabetically consecutive letters (in any order). Words like education, foghorn ...
37
votes
53answers
6k views

Check whether letters of word are in alphabetical order

Write a function/program that accepts a string of lower/uppercase letters [A-Za-z] as input, that checks whether the occuring letters are unique and in alphabetical order (ignoring lower and uppercase)...
16
votes
54answers
2k views

Nest a string inside an array n times

You must produce a function which nests a string s inside an array, n times ...
72
votes
40answers
7k views

Happy Birthday V!

Thanks to @KritixiLithos for helping me out with this challenge! V is a programming language that I wrote so that I could use and extend vim for code-golf challenges. The very first commit was on ...
39
votes
27answers
3k views

Marquee sign letters

Each day you put up a new word on a marquee sign with movable letters, buying just the letters you need to write it. You re-use letters you've bought for earlier words whenever possible. Given the ...
4
votes
13answers
915 views

Write the shortest code to match a tail-repeating string where one character falls off the head in each repetition

In this code-golf, you will attempt to match a string that is tail-repeating with one character falling off the head on each iteration. The code needs to be able to accept a string, and return to the ...
29
votes
4answers
2k views

Print the new site header

The new site header has some bits of source code from various questions as the background. Here are the first 3 lines: ...
28
votes
47answers
3k views

Transpose a page of text

EDIT I modified the wording of the rules to make some things which were implicit more explicit. I also added some emphasis to clear up some points of apparent confusion, and explicitly defined the ...
63
votes
18answers
8k views

All in all it's just, uh, another trick in code golf

The purpose of this challenge is to produce an ASCII version of the cover of this great album by the rock band Pink Floyd. The brick junctions are made of characters ...
13
votes
9answers
396 views

Word Changer Reachability

Word changer is a game where you are trying to turn one word into another via single-character edits, with each step being its own word. For this challenge, edits may be replacements, insertions, or ...
145
votes
256answers
37k views

1, 2, Fizz, 4, Buzz

Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
58
votes
36answers
4k views

Let's do some “deciph4r4ng”

In this challenge, your task is to decipher a string. Luckily, the algorithm is pretty simple: reading from left to right, each encountered digit N (0 to 9) must be replaced with the character which ...
51
votes
43answers
7k views

Print all ASCII alphanumeric characters without using them

Challenge Print the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 The catch is that you may not use any one of them in ...
21
votes
21answers
2k views

Overlapping String-Blocks

Challenge: Given a list of multi-line strings, overlap them (in the top-left) and output the result. Example: Input: ["aaaa\naaaa\naaaa\naaaa","bb\nbb\nbb","c"] ...
16
votes
47answers
4k views

Greeting The User

Create a program which when run displays the text below: )-*-*-*^_^*-*-*-( | Welcome User! | )-*-*-*^_^*-*-*-( Use any functions or language to answer this, have ...
20
votes
34answers
2k views

Read a password

Your challenge is to read a "password" from the keyboard / standard input. Challenge: Read a string s invisibly. For each of the characters in ...
404
votes
742answers
120k views

“Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
10
votes
83answers
2k views

What's the file extension?

Your challenge is to find the file extension of a provided filename: ...
20
votes
8answers
1k views

Almost a Columbo episode

Your task is to find two missing characters in a Columbo episode title. Input One of the 69 Columbo episode titles (as listed below), with exactly two characters replaced with ...
16
votes
37answers
2k views

Split into three!

Given a string, you've to split it into groups of three characters (by padding _ at the end). Related, but still it's different. Sample I/O: ...
71
votes
139answers
15k views

“99 Bottles of Beer”

Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible. Lyrics: ...
1
vote
3answers
257 views

Manhattan Directions Code Golf

This code golf challenge is to show directions through numbers. When the user enters a number, then that means a direction change as follows: ...
42
votes
49answers
4k views

Scrabble scorer

Challenge: Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English. Rules: The score of each letter is as ...
57
votes
8answers
3k views

Make the Stretchy Snakes Kiss

A stretchy snake looks something like this: <||=|||:)~ Each separate sequence of vertical bars (|) in a stretchy snake, ...
34
votes
12answers
3k views

Lemon-Limify a String

Write a program or function that takes in a nonempty single-line string. You may assume it only contains printable ASCII excluding space. Print or return an ASCII art lozenge shape similar to a lemon ...
19
votes
9answers
876 views

Prefix Notation to Postfix Notation

Disclaimer: No, this is not a joke challenge to reverse a string. Task There is only one operation to support: subtraction (-). You also only have two atoms to ...
3
votes
19answers
1k views

It's Not 2015 Anymore!

The Rules Each submission must be a full program or a function. The program must take all instances of the string 2015 from the input (1 string), replace it with <...
80
votes
133answers
12k views

Print a Tabula Recta!

Print a Tabula Recta! The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere ...
21
votes
12answers
2k views

All possible ways to interleave two strings

I recently saw this question on stackoverflow. It's a great question, but there's one fatal problem with the question. They are asking for the best way to do it. E.g, easiest to read, most idiomatic, ...
30
votes
43answers
4k views

pwaS eht tirsf dna tasl setterl fo hace dorw

Or, "Swap the first and last letters of each word" Your challenge is to, given a string of alphabetical ASCII characters as well as one other character to use as a delimiter (to separate each word), ...
11
votes
10answers
1k views

Split string into n pieces (or pieces of length n)

The Challenge In this challenge you have to do two different (but related) tasks depending of the order of the input. Your program will recieve a string s and an ...
-4
votes
10answers
344 views

Point out a string character [closed]

Introduction In many programming languages, within syntax exceptions, it is often pointed out to the programmer exactly which character or line is the culprit. This challenge will be a bit of a ...
30
votes
29answers
3k views

Greatest common substring

Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no ...
45
votes
34answers
2k views

The Third String

Given two strings, output a third string that is not equal to either of the two inputs, but has the same length (in characters) as either of the inputs. There is guaranteed to be at least one valid ...
15
votes
7answers
539 views

You've got a book to make!

You work at a virtual, old-fashioned printing press. To help you arrange your monospace letters faster, you decide to make the shortest program possible to help you. Given a string of text and a page ...
9
votes
10answers
640 views

Determine if a grid contains another grid

Challenge Create a function takes in two 2-dimensional arrays of Characters (or Strings if the programming language does not have characters as a datatype) as inputs: a and b. If your language does ...
368
votes
36answers
51k views

Covfefify a string

In this challenge, you must take a string matching the regex ^[a-zA-Z]+$ or whatever is reasonable (you don't have to consider uppercase or lowercase letters if you ...
114
votes
54answers
26k views

GO OUT AND VOTE

Today is November 8th, 2016, Election Day in the United States of America. If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do ...
45
votes
48answers
9k views

Animate the text in your terminal

Animate the text in your terminal The goal The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other. Your program can exit after ...