Is there a smaller tautogram checker?“Convenient palindrome” checkerPrelude Syntax-CheckerA Basic Pyth-like Syntax CheckerChaining autogramsCreate a basic autocorrecting spell checkerEOC Vault Password Rank 3 Puzzle - Vault PasswordFind the last three words of each paragraph if they are shorter than 20 characters in totalVEVO User Account CheckerIsogram checkerCheckers Checker
How can I raise concerns with a new DM about XP splitting?
For airliners, what prevents wing strikes on landing in bad weather?
Identify a stage play about a VR experience in which participants are encouraged to simulate performing horrific activities
A car is moving at 40 km/h. A fly at 100 km/h, starts from wall towards the car(20 km away)flies to car and back. How many trips can it make?
What if somebody invests in my application?
Proof of Lemma: Every integer can be written as a product of primes
How do ultrasonic sensors differentiate between transmitted and received signals?
Can a Gentile theist be saved?
Reply ‘no position’ while the job posting is still there (‘HiWi’ position in Germany)
I2C signal and power over long range (10meter cable)
Why does this part of the Space Shuttle launch pad seem to be floating in air?
Meta programming: Declare a new struct on the fly
Adding empty element to declared container without declaring type of element
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
You're three for three
Can somebody explain Brexit in a few child-proof sentences?
node command while defining a coordinate in TikZ
What does the "3am" section means in manpages?
Female=gender counterpart?
Is there any significance to the Valyrian Stone vault door of Qarth?
Teaching indefinite integrals that require special-casing
Music terminology - why are seven letters used to name scale tones
Can a Bard use an arcane focus?
How to interpret the phrase "t’en a fait voir à toi"?
Is there a smaller tautogram checker?
“Convenient palindrome” checkerPrelude Syntax-CheckerA Basic Pyth-like Syntax CheckerChaining autogramsCreate a basic autocorrecting spell checkerEOC Vault Password Rank 3 Puzzle - Vault PasswordFind the last three words of each paragraph if they are shorter than 20 characters in totalVEVO User Account CheckerIsogram checkerCheckers Checker
$begingroup$
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This is not a Tautogram
False
I came up with this python code (because it is my main language):
print(True if len(list(set([x.upper()[0] for x in __import__('sys').argv[1:]]))) == 1 else False)
Usage:
python3 tautogram.py Flowers flourish from France
# True
python3 tautogram.py This is not a Tautogram
# False
The sentence can include punctuation.
Its size is 98 bytes. Is there a smaller solution in any language?
code-golf string decision-problem
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
|
show 2 more comments
$begingroup$
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This is not a Tautogram
False
I came up with this python code (because it is my main language):
print(True if len(list(set([x.upper()[0] for x in __import__('sys').argv[1:]]))) == 1 else False)
Usage:
python3 tautogram.py Flowers flourish from France
# True
python3 tautogram.py This is not a Tautogram
# False
The sentence can include punctuation.
Its size is 98 bytes. Is there a smaller solution in any language?
code-golf string decision-problem
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
1
$begingroup$
Is it intended as atipsquestion limited toPython? If so, these both tags should be added.
$endgroup$
– Arnauld
1 hour ago
1
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
1
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
2
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago
|
show 2 more comments
$begingroup$
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This is not a Tautogram
False
I came up with this python code (because it is my main language):
print(True if len(list(set([x.upper()[0] for x in __import__('sys').argv[1:]]))) == 1 else False)
Usage:
python3 tautogram.py Flowers flourish from France
# True
python3 tautogram.py This is not a Tautogram
# False
The sentence can include punctuation.
Its size is 98 bytes. Is there a smaller solution in any language?
code-golf string decision-problem
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This is not a Tautogram
False
I came up with this python code (because it is my main language):
print(True if len(list(set([x.upper()[0] for x in __import__('sys').argv[1:]]))) == 1 else False)
Usage:
python3 tautogram.py Flowers flourish from France
# True
python3 tautogram.py This is not a Tautogram
# False
The sentence can include punctuation.
Its size is 98 bytes. Is there a smaller solution in any language?
code-golf string decision-problem
code-golf string decision-problem
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 hour ago
Stephen
7,49723397
7,49723397
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
Jaime TenorioJaime Tenorio
263
263
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Jaime Tenorio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
$begingroup$
Is it intended as atipsquestion limited toPython? If so, these both tags should be added.
$endgroup$
– Arnauld
1 hour ago
1
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
1
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
2
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago
|
show 2 more comments
1
$begingroup$
Is it intended as atipsquestion limited toPython? If so, these both tags should be added.
$endgroup$
– Arnauld
1 hour ago
1
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
1
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
2
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago
1
1
$begingroup$
Is it intended as a
tips question limited to Python? If so, these both tags should be added.$endgroup$
– Arnauld
1 hour ago
$begingroup$
Is it intended as a
tips question limited to Python? If so, these both tags should be added.$endgroup$
– Arnauld
1 hour ago
1
1
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
1
1
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
2
2
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago
|
show 2 more comments
9 Answers
9
active
oldest
votes
$begingroup$
PowerShell, 57 50 bytes
(-split"$args"|%"$($_[0])"|group).Name.count-eq1
Try it online!
Takes input and splits it on whitespace. Loops through each word, takes the first letter $_[0]. Then groups the letters (case-insensitive by default), takes the names, and verifies the count of those names are -equal to 1. Output is implicit.
The Group).Name.count seems long, but I can't figure out how to shorten it yet.
$endgroup$
add a comment |
$begingroup$
05AB1E, 5 bytes
l#€нË
Try it online!
Did this on mobile excuse the no explanation.
$endgroup$
add a comment |
$begingroup$
Python 2, 47 bytes
lambda s:len(set(zip(*s.lower().split())[0]))<2
Try it online!
Came up with this on mobile. Can probably be golfed more.
$endgroup$
add a comment |
$begingroup$
05AB1E (legacy), 5 bytes
#€¬uË
Try it online!
# // split on spaces
€¬ // get the first letter of each word
uË // check if they're the same (uppercase) letter
$endgroup$
add a comment |
$begingroup$
Haskell, 71 bytes
f s|c<-fromEnum.head<$>words s=all(`elem`[-32,0,32]).zipWith(-)c$tail c
Try it online!
Haskell, 61 bytes (using Data.Char.toLower)
import Data.Char
(all=<<(==).head).map head.words.map toLower
Try it online!
$endgroup$
$begingroup$
...map(toLower.head).words.
$endgroup$
– nimi
30 mins ago
add a comment |
$begingroup$
JavaScript (Node.js), 54 bytes
s=>!s.match(/bw+/g).some(p=s=>p-(p=Buffer(s)[0]&31))
Try it online!
Or 47 bytes if each word (but the first) is guaranteed to be preceded by a space.
$endgroup$
$begingroup$
or in one regex or with a space instead ofW
$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, usingtestsaves another byte.
$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
add a comment |
$begingroup$
Japt -¡, 5 bytes
¸mÎro
Try it
¸mÎro :Implicit input of string
¸ :Split on spaces
m :Map
Î : Get first character
r :Reduce by
o : Keeping the characters that appear in both, case-insensitive
:Implicit output as boolean
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 41 bytes
n=>n.Split().GroupBy(c=>c[0]|32).Single()
Throws an exception if false, nothing if true.
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 5 (-p), 20 bytes
$_=!/^(.).* (?!1)/i
TIO
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Jaime Tenorio is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182175%2fis-there-a-smaller-tautogram-checker%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
PowerShell, 57 50 bytes
(-split"$args"|%"$($_[0])"|group).Name.count-eq1
Try it online!
Takes input and splits it on whitespace. Loops through each word, takes the first letter $_[0]. Then groups the letters (case-insensitive by default), takes the names, and verifies the count of those names are -equal to 1. Output is implicit.
The Group).Name.count seems long, but I can't figure out how to shorten it yet.
$endgroup$
add a comment |
$begingroup$
PowerShell, 57 50 bytes
(-split"$args"|%"$($_[0])"|group).Name.count-eq1
Try it online!
Takes input and splits it on whitespace. Loops through each word, takes the first letter $_[0]. Then groups the letters (case-insensitive by default), takes the names, and verifies the count of those names are -equal to 1. Output is implicit.
The Group).Name.count seems long, but I can't figure out how to shorten it yet.
$endgroup$
add a comment |
$begingroup$
PowerShell, 57 50 bytes
(-split"$args"|%"$($_[0])"|group).Name.count-eq1
Try it online!
Takes input and splits it on whitespace. Loops through each word, takes the first letter $_[0]. Then groups the letters (case-insensitive by default), takes the names, and verifies the count of those names are -equal to 1. Output is implicit.
The Group).Name.count seems long, but I can't figure out how to shorten it yet.
$endgroup$
PowerShell, 57 50 bytes
(-split"$args"|%"$($_[0])"|group).Name.count-eq1
Try it online!
Takes input and splits it on whitespace. Loops through each word, takes the first letter $_[0]. Then groups the letters (case-insensitive by default), takes the names, and verifies the count of those names are -equal to 1. Output is implicit.
The Group).Name.count seems long, but I can't figure out how to shorten it yet.
answered 1 hour ago
AdmBorkBorkAdmBorkBork
27.5k466237
27.5k466237
add a comment |
add a comment |
$begingroup$
05AB1E, 5 bytes
l#€нË
Try it online!
Did this on mobile excuse the no explanation.
$endgroup$
add a comment |
$begingroup$
05AB1E, 5 bytes
l#€нË
Try it online!
Did this on mobile excuse the no explanation.
$endgroup$
add a comment |
$begingroup$
05AB1E, 5 bytes
l#€нË
Try it online!
Did this on mobile excuse the no explanation.
$endgroup$
05AB1E, 5 bytes
l#€нË
Try it online!
Did this on mobile excuse the no explanation.
answered 1 hour ago
Magic Octopus UrnMagic Octopus Urn
12.8k444126
12.8k444126
add a comment |
add a comment |
$begingroup$
Python 2, 47 bytes
lambda s:len(set(zip(*s.lower().split())[0]))<2
Try it online!
Came up with this on mobile. Can probably be golfed more.
$endgroup$
add a comment |
$begingroup$
Python 2, 47 bytes
lambda s:len(set(zip(*s.lower().split())[0]))<2
Try it online!
Came up with this on mobile. Can probably be golfed more.
$endgroup$
add a comment |
$begingroup$
Python 2, 47 bytes
lambda s:len(set(zip(*s.lower().split())[0]))<2
Try it online!
Came up with this on mobile. Can probably be golfed more.
$endgroup$
Python 2, 47 bytes
lambda s:len(set(zip(*s.lower().split())[0]))<2
Try it online!
Came up with this on mobile. Can probably be golfed more.
answered 1 hour ago
TFeldTFeld
15.9k21449
15.9k21449
add a comment |
add a comment |
$begingroup$
05AB1E (legacy), 5 bytes
#€¬uË
Try it online!
# // split on spaces
€¬ // get the first letter of each word
uË // check if they're the same (uppercase) letter
$endgroup$
add a comment |
$begingroup$
05AB1E (legacy), 5 bytes
#€¬uË
Try it online!
# // split on spaces
€¬ // get the first letter of each word
uË // check if they're the same (uppercase) letter
$endgroup$
add a comment |
$begingroup$
05AB1E (legacy), 5 bytes
#€¬uË
Try it online!
# // split on spaces
€¬ // get the first letter of each word
uË // check if they're the same (uppercase) letter
$endgroup$
05AB1E (legacy), 5 bytes
#€¬uË
Try it online!
# // split on spaces
€¬ // get the first letter of each word
uË // check if they're the same (uppercase) letter
answered 57 mins ago
RileyRiley
11k11448
11k11448
add a comment |
add a comment |
$begingroup$
Haskell, 71 bytes
f s|c<-fromEnum.head<$>words s=all(`elem`[-32,0,32]).zipWith(-)c$tail c
Try it online!
Haskell, 61 bytes (using Data.Char.toLower)
import Data.Char
(all=<<(==).head).map head.words.map toLower
Try it online!
$endgroup$
$begingroup$
...map(toLower.head).words.
$endgroup$
– nimi
30 mins ago
add a comment |
$begingroup$
Haskell, 71 bytes
f s|c<-fromEnum.head<$>words s=all(`elem`[-32,0,32]).zipWith(-)c$tail c
Try it online!
Haskell, 61 bytes (using Data.Char.toLower)
import Data.Char
(all=<<(==).head).map head.words.map toLower
Try it online!
$endgroup$
$begingroup$
...map(toLower.head).words.
$endgroup$
– nimi
30 mins ago
add a comment |
$begingroup$
Haskell, 71 bytes
f s|c<-fromEnum.head<$>words s=all(`elem`[-32,0,32]).zipWith(-)c$tail c
Try it online!
Haskell, 61 bytes (using Data.Char.toLower)
import Data.Char
(all=<<(==).head).map head.words.map toLower
Try it online!
$endgroup$
Haskell, 71 bytes
f s|c<-fromEnum.head<$>words s=all(`elem`[-32,0,32]).zipWith(-)c$tail c
Try it online!
Haskell, 61 bytes (using Data.Char.toLower)
import Data.Char
(all=<<(==).head).map head.words.map toLower
Try it online!
edited 56 mins ago
answered 1 hour ago
Jonathan FrechJonathan Frech
6,47311040
6,47311040
$begingroup$
...map(toLower.head).words.
$endgroup$
– nimi
30 mins ago
add a comment |
$begingroup$
...map(toLower.head).words.
$endgroup$
– nimi
30 mins ago
$begingroup$
...map(toLower.head).words.$endgroup$
– nimi
30 mins ago
$begingroup$
...map(toLower.head).words.$endgroup$
– nimi
30 mins ago
add a comment |
$begingroup$
JavaScript (Node.js), 54 bytes
s=>!s.match(/bw+/g).some(p=s=>p-(p=Buffer(s)[0]&31))
Try it online!
Or 47 bytes if each word (but the first) is guaranteed to be preceded by a space.
$endgroup$
$begingroup$
or in one regex or with a space instead ofW
$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, usingtestsaves another byte.
$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
add a comment |
$begingroup$
JavaScript (Node.js), 54 bytes
s=>!s.match(/bw+/g).some(p=s=>p-(p=Buffer(s)[0]&31))
Try it online!
Or 47 bytes if each word (but the first) is guaranteed to be preceded by a space.
$endgroup$
$begingroup$
or in one regex or with a space instead ofW
$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, usingtestsaves another byte.
$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
add a comment |
$begingroup$
JavaScript (Node.js), 54 bytes
s=>!s.match(/bw+/g).some(p=s=>p-(p=Buffer(s)[0]&31))
Try it online!
Or 47 bytes if each word (but the first) is guaranteed to be preceded by a space.
$endgroup$
JavaScript (Node.js), 54 bytes
s=>!s.match(/bw+/g).some(p=s=>p-(p=Buffer(s)[0]&31))
Try it online!
Or 47 bytes if each word (but the first) is guaranteed to be preceded by a space.
answered 1 hour ago
ArnauldArnauld
79.6k797330
79.6k797330
$begingroup$
or in one regex or with a space instead ofW
$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, usingtestsaves another byte.
$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
add a comment |
$begingroup$
or in one regex or with a space instead ofW
$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, usingtestsaves another byte.
$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
$begingroup$
or in one regex or with a space instead of
W$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
or in one regex or with a space instead of
W$endgroup$
– Nahuel Fouilleul
46 mins ago
$begingroup$
@NahuelFouilleul, using
test saves another byte.$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul, using
test saves another byte.$endgroup$
– Shaggy
36 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
@NahuelFouilleul You should probably post is separately.
$endgroup$
– Arnauld
26 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
$begingroup$
already posted the perl version, i don't master as well javascript, i'm happy to give you a hint
$endgroup$
– Nahuel Fouilleul
13 mins ago
add a comment |
$begingroup$
Japt -¡, 5 bytes
¸mÎro
Try it
¸mÎro :Implicit input of string
¸ :Split on spaces
m :Map
Î : Get first character
r :Reduce by
o : Keeping the characters that appear in both, case-insensitive
:Implicit output as boolean
$endgroup$
add a comment |
$begingroup$
Japt -¡, 5 bytes
¸mÎro
Try it
¸mÎro :Implicit input of string
¸ :Split on spaces
m :Map
Î : Get first character
r :Reduce by
o : Keeping the characters that appear in both, case-insensitive
:Implicit output as boolean
$endgroup$
add a comment |
$begingroup$
Japt -¡, 5 bytes
¸mÎro
Try it
¸mÎro :Implicit input of string
¸ :Split on spaces
m :Map
Î : Get first character
r :Reduce by
o : Keeping the characters that appear in both, case-insensitive
:Implicit output as boolean
$endgroup$
Japt -¡, 5 bytes
¸mÎro
Try it
¸mÎro :Implicit input of string
¸ :Split on spaces
m :Map
Î : Get first character
r :Reduce by
o : Keeping the characters that appear in both, case-insensitive
:Implicit output as boolean
answered 1 hour ago
ShaggyShaggy
18.9k21667
18.9k21667
add a comment |
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 41 bytes
n=>n.Split().GroupBy(c=>c[0]|32).Single()
Throws an exception if false, nothing if true.
Try it online!
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 41 bytes
n=>n.Split().GroupBy(c=>c[0]|32).Single()
Throws an exception if false, nothing if true.
Try it online!
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 41 bytes
n=>n.Split().GroupBy(c=>c[0]|32).Single()
Throws an exception if false, nothing if true.
Try it online!
$endgroup$
C# (Visual C# Interactive Compiler), 41 bytes
n=>n.Split().GroupBy(c=>c[0]|32).Single()
Throws an exception if false, nothing if true.
Try it online!
answered 1 hour ago
Embodiment of IgnoranceEmbodiment of Ignorance
2,168125
2,168125
add a comment |
add a comment |
$begingroup$
Perl 5 (-p), 20 bytes
$_=!/^(.).* (?!1)/i
TIO
$endgroup$
add a comment |
$begingroup$
Perl 5 (-p), 20 bytes
$_=!/^(.).* (?!1)/i
TIO
$endgroup$
add a comment |
$begingroup$
Perl 5 (-p), 20 bytes
$_=!/^(.).* (?!1)/i
TIO
$endgroup$
Perl 5 (-p), 20 bytes
$_=!/^(.).* (?!1)/i
TIO
answered 53 mins ago
Nahuel FouilleulNahuel Fouilleul
2,915211
2,915211
add a comment |
add a comment |
Jaime Tenorio is a new contributor. Be nice, and check out our Code of Conduct.
Jaime Tenorio is a new contributor. Be nice, and check out our Code of Conduct.
Jaime Tenorio is a new contributor. Be nice, and check out our Code of Conduct.
Jaime Tenorio is a new contributor. Be nice, and check out our Code of Conduct.
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182175%2fis-there-a-smaller-tautogram-checker%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
$begingroup$
Is it intended as a
tipsquestion limited toPython? If so, these both tags should be added.$endgroup$
– Arnauld
1 hour ago
1
$begingroup$
Heya friend! This site is usually reserved for explicitly defined problems. Things like "can the input contain punctuation" should be answered before posting, but other than that this is a great first question comparatively to the other new-user questions we usually see. Judging by your examples I'd just clarify that the only characters in the input will be "[A-Za-z ]" and your question will be purely objective. I'd scope out some other questions around here, else this may honestly be a better fit on overflow.
$endgroup$
– Magic Octopus Urn
1 hour ago
$begingroup$
What do you mean by punctuation? Which characters are included?
$endgroup$
– Embodiment of Ignorance
1 hour ago
1
$begingroup$
@MagicOctopusUrn Sometimes when you ask for a short solution in stackOverflow the refer to this site :)
$endgroup$
– Luis felipe De jesus Munoz
1 hour ago
2
$begingroup$
Welcome to PPCG! A few more test cases (including punctuation) would be a great addition to this challenge.
$endgroup$
– AdmBorkBork
1 hour ago