-11
\$\begingroup\$

Write a script, program or function which takes one input of type string and outputs or returns some sort of indication wether the input string was 'hi whats up' (without the apostrophes) or not.

You can for example return true if it was and false if it wasn't. Or print something to the screen, like 1 or 0.

It just has to be consistent: whenever you run the function with parameter/input 'hi whats up' the same output/return should emerge (so don't make it random) and whenever the input is something else, the other possible outcome is expected (it has to be always the same, whatever the input was!). In conclusion, your function/script can only have in total 2 different possible outcomes.

The catch is, your entire code must not contain any of these characters: h, i, w, a, t, s, u, p

Code golf: shortest code in bytes wins.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Space is allowed \$\endgroup\$
    – Squareoot
    Nov 8 at 10:26
  • 6
    \$\begingroup\$ Sounds like a "do X without Y" challenge \$\endgroup\$ Nov 8 at 10:29
  • 8
    \$\begingroup\$ Please avoid "do X without Y" challenges. Using the Sandbox can help you detect such issues. \$\endgroup\$
    – Adám
    Nov 8 at 15:28
  • \$\begingroup\$ Are diacritics okay? \$\endgroup\$
    – code
    Nov 20 at 3:30
  • \$\begingroup\$ @code yeah, BTW lit username! \$\endgroup\$
    – Squareoot
    Nov 20 at 17:15

11 Answers 11

4
\$\begingroup\$

Python 3, 29 bytes

"HI WHATS UP".loʷer().__eq__

Try it online!

An anonymous function taking a string as input. See Using object methods as answer.

\$\endgroup\$
3
\$\begingroup\$

APL (Dyalog Extended), 16 bytes

Full program. Prints 1 for a match, 0 otherwise.

⍞≡⌊'HI WHATS UP'

Try it online!

Does the input match the lowercased string 'HI WHATS UP'?

\$\endgroup\$
3
\$\begingroup\$

Excel, 31 bytes

=EXACT(A1,LOWER("HI WHATS UP"))

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ your code contains A,W and T \$\endgroup\$ Nov 9 at 13:45
  • 4
    \$\begingroup\$ @t-clausen.dk A is not equal to a. \$\endgroup\$
    – jdt
    Nov 9 at 14:11
  • 4
    \$\begingroup\$ I am starting to understand the downvotes for the question \$\endgroup\$ Nov 14 at 20:26
2
\$\begingroup\$

Ruby, 62 bytes

->b{b==""<<104<<105<<32<<119<<104<<97<<116<<115<<32<<117<<112}

Try it online!

\$\endgroup\$
2
\$\begingroup\$

05AB1E, 8 bytes

…ŒÞÝà€¾Q

Outputs 1 if the input is hi whats up, 0 otherwise.

Try it online or verify some more test cases.

Explanation:

Pretty straight-forward.

…ŒÞÝà€¾   # Push dictionary string "hi whats up"
       Q  # Check if it's equal to the (implicit) input
          # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why …ŒÞÝà€¾ is "hi whats up".

\$\endgroup\$
2
\$\begingroup\$

C (clang), 68 62 57 bytes

f(*x,n,*r){for(*r=0;~n;)*r|="()`7(!43`50@"[n]^x[n--]^64;}

Try it online!

\$\endgroup\$
0
1
\$\begingroup\$

Vyxal, 10 bytes

«⟇>βX⋏⋏ƈ«=

Try it Online!

Base 255 compressed string for the phrase "hi whats up" compared against the input.

\$\endgroup\$
1
\$\begingroup\$

Retina 0.8.2, 21 bytes

T`Ll`lL
^HI WHATS UP$

Try it online! Link includes test cases. Explanation:

T`Ll`lL

Toggle the case of the input.

^HI WHATS UP$

Compare it against the uppercased phrase.

\$\endgroup\$
1
\$\begingroup\$

Charcoal, 12 bytes

⁼S”↶⌊&νξ←₂Yδ

Try it online! No verbose link because the deverbosifier doesn't realise it can save a byte by omitting the closing quote. Explanation: Simply compares the input string to the compressed form of the phrase.

\$\endgroup\$
1
\$\begingroup\$

Factor, 24 bytes

[ "no&}ngzy&{v"6 v-n = ]

Attempt This Online!

Subtracting 6 from each code point in the string "no&}ngzy&{v" results in "hi whats up", then check for equality.

\$\endgroup\$
1
\$\begingroup\$

Python 3, 89 101 85 bytes

Hey, hey hey.... nobody said you couldn't use code points! Doesn't use object methods or superscript ASCIIs unlike the other answer

Thanks to Dingus and Arnauld for pointing out 2 mistakes. Apparently I'm bad at detecting stuff. Also thanks to Arnauld for letting me forget about 1s and 0s

exec("\x70r\x69n\x74(\x69n\x70\x75\x74()=='\x68\x69 \x77\x68\x61\x74\x73 \x75\x70')")
\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.