21
1
We often see music videos on Youtube. Many Youtube channels that host music videos are "powered by VEVO". Those can be easily identified by both embedding VEVO at their video thumbnails and appending VEVO to their channel name.
Now write some code to test whether a string given by user is a VEVO user account or not.
Requirements for valid VEVO user account strings:
Must only contain uppercase, lowercase, and digit characters. (no whitespace or punctuation)
Must not exceed 80 characters length.
Must have "VEVO" substring at the end of string
Test cases:
Valid inputs:
AdeleVEVO
ConnieTalbotVEVO
SHMVEVO
justimberlakeVEVO
DJMartinJensenVEVO
test123VEVO
Invalid inputs:
syam kapuk
jypentertainment
Noche de Brujas
testVEVO123
Of course, because this is code-golf, I'm looking for the shortest code using any programming language.
4Nice first question! +1 – LiefdeWen – 2017-12-21T10:47:45.557
12test-cases:
VEVO
andūņīčōdēVEVO
– dzaima – 2017-12-21T11:02:37.7738other suggested test cases:
test123VeVo
and one with more than 80 characters – Arnauld – 2017-12-21T11:09:05.5176You should wait a lot longer before accepting a best answer; the question has only been up for an hour and there are plenty more languages that people might answer in! – Luke Stevens – 2017-12-21T11:56:54.687
2What's considered acceptable output here? Would
0
for valid and another/any other number for invalid be allowed? – Shaggy – 2017-12-21T12:11:29.0334Another suggested test case:
test123 VEVO
(ends with VEVO but contains whitespace) – Brian J – 2017-12-21T14:38:05.2003Alternatively, it is even better if you don't accept an answer at all, so that it is more a competition between answers in each language, rather than between languages. – caird coinheringaahing – 2017-12-21T15:43:42.607
5"uppercase, lowercase, and digit characters" requires defining (I would assume (as, I believe, all have done already) that you mean A-Za-z0-9; but it could mean anything that may be uppercased or lowercased, for example
ạ
andẠ
and digits in other alphabets, for example九
(9). – Jonathan Allan – 2017-12-21T21:19:50.3633If you're going to accept any answer, please accept the shortest (the winner), rather than an arbitrary answer. – caird coinheringaahing – 2017-12-23T20:30:58.673
Can I invert the the valid/invalid and return True for an invalid string and false for a valid one? – Rɪᴋᴇʀ – 2017-12-29T04:57:37.363
2Downside of accepting the Fish answer after only an hour: its the second longest answer that's currently available and most definitely not the winner... – Draco18s no longer trusts SE – 2017-12-29T07:05:16.057