Search Results
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 |
A competition to solve a particular problem through the usage and manipulation of strings.
2
votes
Don't google "google"
It simply checks if the argument (string) is "google" and calls terminate if it is - else it returns the length of the string.
It can be called as such:
[](auto s){return s=="google"? …
3
votes
Implement "tac": Print lines from a file in reverse
Powershell, 41 bytes
$a=$args|%{gc $_};[array]::Reverse($a);$a
Stores the content of a file line by line in a, reverses a and finally prints it.
10
votes
Longest Common Prefix of 2 Strings
C++, 101 100 99 bytes
#include<iostream>
int i;main(){std::string s,t;std::cin>>s>>t;for(;s[i]==t[i];std::cout<<s[i++]);}
Reads two strings from stdin, prints the character at the current position from … one of the strings while the character at the current position is equal to the character at the same position in the other string. …
2
votes
Shortest code to check if a string has only letters
C++14, 132 126 121 117 121 bytes
#include<iostream>
main(){std::string s;getline(std::cin,s);for(char c:s)if(!isalpha(c)&! …
2
votes
Horizontal graph of word length
C++14, 107 106 bytes
#include<iostream>
main(){std::string s;for(;std::cin>>s;){for(char c:s)std::cout<<'*';std::cout<<'\n';}} …