2022 Developer Survey is open! Take survey.

Questions tagged [string]

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

Filter by
Sorted by
Tagged with
20 votes
6 answers
1k views

A Snake, A Camel And A Kebab

As many of you will know, almost every programming language has a standard casing system; unfortunately, we have not been able to agree on a singular system to use and now must frequently switch ...
user avatar
  • 1,057
8 votes
6 answers
718 views

(1) Determine the amount of statues

Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands: This is split into two different ...
user avatar
7 votes
2 answers
240 views

(2) Can the statues be stacked?

Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands: This is split into two different ...
user avatar
13 votes
7 answers
685 views

Iterate over the neighborhood of a string

Input A string S of length between 2 and 30. The only letters in the string will be a or b. Output All strings within ...
user avatar
19 votes
21 answers
1k views

Scramble a Megaminx!

Scramble a Megaminx! A megaminx is a dodecahedral version of the familiar Rubik's cube. Since 2008, the World Cube Association uses Stefan Pochmann's megaminx scrambler. The scrambles look like this: <...
user avatar
  • 10.9k
12 votes
9 answers
773 views

Mimic the X11 Primary selection

Background In X11 (a windowing system used by a lot of Unix-like OS), what you would call the clipboard behave a bit differently than on other OSes like MacOS or Windows. While the "traditional&...
user avatar
  • 291
38 votes
8 answers
5k views

Translate English to English

You have been hired by the American embassy in the UK to act as a translator. Being a programmer, you decide to write a program to do a bit of the work for you. You've found out that often just doing ...
user avatar
  • 9,266
11 votes
21 answers
3k views

Advent of Code 2020, Day 2, Part 1

Today, my girlfriend and I started with this year's Advent of Code to improve our Python. So far we only did Day 1 and the first part of Day 2. The latter, I found to be very fun, so, to spice it up a ...
user avatar
  • 299
2 votes
12 answers
693 views

just a caesar cipher... with a twist [closed]

I have been going to puzzling.se, and people over there write stuff in rot13 a lot, sot this gave me an idea: Write a program that takes 2 inputs, a string and integer: the message to encode or ...
user avatar
  • 45
21 votes
23 answers
1k views

Compatible strings

When studying numerology, you can say two words (strings consisting entirely of letters) are compatible if they produce the same number under the following operation (let's use the string ...
user avatar
18 votes
17 answers
520 views

Align a list of numbers [duplicate]

Perhaps something like this is here already, but I couldn't find it. It is not the same as Aligning Lines!. Example: Input: 98.6 $2,750.17 -$23 -86 3,120,487.19 ...
user avatar
1 vote
1 answer
399 views

Hacker Challenge: Guess the Correct Password

In an attempt to “liberate” their fellow birds, a group of highly intelligent hens are attempting to compromise the zoo’s security system. To get access to the zoo’s mainframe, the hens first need to ...
user avatar
  • 447
21 votes
38 answers
4k views

Is It A Rainbow Color?

Challenge: The challenge is to determine whether or not a color, given it's name, is one of the colors in the rainbow. When supplied with a color, your program should output a truthy value if it is a ...
user avatar
  • 1,057
6 votes
8 answers
868 views

Bi-directional translator

Bi-directional translator The challenge is to create a translator that can translate a [a-zA-Z ] string into another string according to the mappings below. The ...
user avatar
7 votes
3 answers
611 views

Day of Week - Natural language processing and date parsing

You'll get a human-readable question matching one of the following syntaxes, and are expected to print/return the corresponding result. Finding similarities between the human-readable inputs and ...
user avatar
19 votes
4 answers
2k views

Simulate my keyboard wave light!

(The word frame in the following text does not mean an actual frame, it is used as a placeholder for an undefined time unit) The task Imagine you have a keyboard layout with only letters like so: <...
user avatar
  • 3,890
21 votes
28 answers
2k views

Get the Systematic Chemical Symbol

Background The systematic chemical symbol is defined as such for \$ 118 < n < 1000 \$: The first letter corresponds to the first digit, capitalized. The second letter corresponds to the second ...
user avatar
  • 2,813
38 votes
17 answers
4k views

Is it a digit haiku?

We can read 13576870234289 digit-by-digit in English, and it makes a haiku: one three five seven six eight seven zero two three four two eight nine We say it's a &...
user avatar
  • 65.5k
7 votes
2 answers
212 views

Unscramble the letters by letter frequency analysis [closed]

You know those riddles where every letter is swapped for another letter? E.g. you get a text like ...
user avatar
14 votes
8 answers
2k views

We're much closer than you think

Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their ...
user avatar
18 votes
23 answers
2k views

Create an Accurate How-To Article

Here is an easy-intermediate challenge for anyone interested! What is that? A thing me and brother do a bit too often is this: One of us has a problem and asks the other to explain how to do certain ...
user avatar
  • 2,599
25 votes
12 answers
2k views

Decide a C integer literal

Objective Given an ASCII string, decide whether it is a valid C integer literal. C integer literal A C integer literal consists of: One of: 0 followed by zero or ...
user avatar
  • 4,163
22 votes
44 answers
3k views

Converting Strings to Decimals (Gone Wrong)

What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in ...
user avatar
  • 2,599
10 votes
6 answers
850 views

Parse a Scala expression

Scala isn't a very commonly used language around here. Most of those who know it like it[citation needed], but some go :\ when they encounter its user-defined ...
user avatar
  • 9,266
19 votes
16 answers
2k views

Size up a number

Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words ...
user avatar
  • 25.2k
15 votes
15 answers
2k views

Palindrome distance

Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it ...
user avatar
  • 20.5k
4 votes
4 answers
2k views

Parse a nested parentheses

Objective Mimic Haskell's reads :: ReadS (). Or in other words, parse nested parentheses. Since the target type is () (the type ...
user avatar
  • 4,163
16 votes
27 answers
2k views

Compactify the query string

Introduction Just on Hacker news, John Resig contemplates transforming a query “foo=1&foo=2&foo=3&blah=a&blah=b” into one that looks like this: “foo=1,2,3&blah=a,b", https://...
user avatar
  • 1,717
20 votes
23 answers
1k views

Find the result of some assignment statements

In this challenge, the goal is to find the values of some variables after a number of assignments are done. An example input: a = 5 b = 4 c = a = b a = 2 b = a ...
user avatar
16 votes
3 answers
964 views

Will all the dominoes fall?

The purpose of this challenge is to figure out whether all the dominoes will fall, given an input string representing a top view of the table. Input format The program can take the input as a single ...
user avatar
  • 9,266
30 votes
38 answers
4k views

I uppercase the source code, you reverse the input!

It's one of these again :D Your task, if you wish to accept it, is to write a program/function (without any uppercase letters) that outputs/returns its string input/argument. The tricky part is that ...
user avatar
12 votes
12 answers
4k views

Is this a robbery?

Backstory You own a tiny jewellery shop in the suburbs of the city. The suburbs are too much overpopulated, so your shop has a thickness of only one character to fit in the busy streets. Recently, ...
user avatar
  • 2,599
35 votes
97 answers
4k views

Lolololololololololololol

Let us take a break from the brain-wrecking questions and answer some of the simpler ones You have recently read something extremely funny, and want to express your laughter to the world! But how can ...
user avatar
  • 2,599
19 votes
46 answers
2k views

Divisible strings

Task Given a string s, output a truthy value if the ASCII code of each letter is divisible by the length of s, and a falsey ...
user avatar
  • 3,890
20 votes
6 answers
2k views

Surround a string with "friendliness pellets"

Input a String and surround it with a rounded rectangle of alternating "friendliness pellets".(0) Sandbox Idea originally from Lyxal. Challenge Given a ...
user avatar
  • 25.2k
8 votes
4 answers
242 views

Find the index of reflection of a substring of a palindrome [closed]

Problem Statement: You will receive a substring of a palindromic string. You must return the index of the substring which marks the point of reflection of the original string. You are only provided ...
user avatar
13 votes
20 answers
1k views

Repeating pattern of empty lines

Write the shortest program or function that takes some text as input, and outputs either it or an empty line in a repeating pattern: ...
user avatar
12 votes
7 answers
622 views

De-interleave log lines: HARD MODE

In the face of some regrettable rules that turned the original into a glorified sorting task, I am posting a more challenging variant. Shout out to Luis Mendo for the suggestion of how to improve the ...
user avatar
  • 9,791
-6 votes
13 answers
358 views

Number chopping: Split a number into its digits [closed]

Number Splitting Instructions Oh no, my numbers have stuck together! Luckily, we can split them apart with code. Your code should be a function that takes an integer input from stdin or as an argument....
user avatar
13 votes
8 answers
1k views

Let's Decrypt It!

Note This is the decryption challenge. The encryption challenge can be found here. Challenge The challenge is to decrypt a given string, using the rules as specified below. The string will only ...
user avatar
  • 4,920
22 votes
20 answers
2k views

Case invert your quine

Write a quine which attempts to invert the case of as many ascii characters in the source code as possible. For example in javascript: ...
user avatar
  • 321
26 votes
6 answers
1k views

Build an alphabetised polyglot

As TIO can show, every letter of the Latin alphabet is represented when it comes to languages. For every letter there is at least 1 programming language whose name begins with that letter. Your task ...
user avatar
18 votes
21 answers
2k views

De-interleave log lines [duplicate]

You've inherited a server that runs several apps which all output to the same log. Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that ...
user avatar
  • 9,791
12 votes
11 answers
954 views

Remove partial matching duplicate lines and retain longest line

Write the shortest possible program to remove all partial matched duplicates from a list and only retain the longest lines. Sort order does not matter. For following inputs, the intent is to search ...
user avatar
14 votes
22 answers
1k views

Mode length of a sentence

The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of ...
user avatar
  • 2,850
42 votes
141 answers
11k views

Print X without X (robber's thread)

This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
user avatar
  • 84.9k
71 votes
155 answers
13k views

Print X without X (cop's thread)

This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but there's a catch! You need to do it ...
user avatar
  • 84.9k
17 votes
20 answers
3k views

And and… and. And.?

Introduction: Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago: Can you create a perfectly valid English sentence, which makes perfect sense, but ...
user avatar
28 votes
75 answers
7k views

Average of your code

Inspired by this Task Your task is to output the average character of your code. What is an average character? Say we have a string golf(). We then take the ASCII ...
user avatar
  • 3,890
24 votes
26 answers
8k views

XOR two strings

Given two strings as input, return the result of XORing the code-points of one string against the code points of the other. For each character in the first input string, take the code-point (e.g. for <...
user avatar

1
3 4
5
6 7
42