Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 3669

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

0 votes

Answer to life, the universe, and everything

R, 99 f=function(x){s="";for(i in 1:26)s=c(s,(rep(letters[i],each=i)));s=paste(s,collapse="");if(x==s)42} Usage: f("test") f("abbcccddddeeeeeffffffggggggghhhhhhhhiiiiiiiiijjjjjjjjjjkkkkkkkkkkkllll …
Paolo's user avatar
  • 726
2 votes

Print custom alphabet

R, 219 Ugly, long... still works. f=function(l){if(!nchar(l)%in%c(1,2))invisible()else{s=ifelse(nchar(l)==1," ","\n");l=substr(l,1,1);v=letters;if(l%in%v){}else v=LETTERS;l=grep(l,v);if(l==26)cat(v[ …
Paolo's user avatar
  • 726
3 votes

How to randomize letters in a word

R, 104 (126) f=function(w){s=strsplit(w,"")[[1]];paste(c(s[1],sample(s[2:(length(s)-1)]),s[length(s)]),collapse="")} Usage: for (i in 1:10) print(f("parola")) [1] "plraoa" [1] "prolaa" [1] "praola …
Paolo's user avatar
  • 726
0 votes

Cambridge Transposition

R, 179 Using the function I wrote for the randomize letters in a word problem: Input: s <- "According to a researcher at Cambridge University, it doesn't matter in what order the letters in a word …
Paolo's user avatar
  • 726
2 votes

Determine whether strings are anagrams

R, 77 f=function(x,y)identical(sort(strsplit(x,"")[[1]]),sort(strsplit(y,"")[[1]])) Sample output: f("boat","boat") [1] TRUE f("toab","boat") [1] TRUE f("oabt","toab") [1] TRUE f("a","aa") [1] FAL …
Paolo's user avatar
  • 726
15 votes

Print the alphabet without using each vowel

R, 17 + 19 = 36 characters no ae (17): intToUtf8(97:122) no iou (19): cat(letters,sep="")
Paolo's user avatar
  • 726