g | x | w | all
Bytes Lang Time Link
nan240808T062633ZRARE Kpo
024Retina 0.8.2240711T001547ZNeil
045R240711T055300Zpajonk
060Python240711T130805Zpajonk
055Python 3.8 prerelease240710T235814Zsquarero
027AWK vIGNORECASE=1240718T130032Zcorvus_1
047Bash240711T080538ZThemooni
nanNibbles240712T151449ZDominic
023QuadR i240711T062145ZAdá
035JavaScript ES6240710T200347ZArnauld
110Go240711T151242Zbigyihsu
060Lexurgy240711T150341Zbigyihsu
033Ruby240711T081015Zint 21h
044Java240711T082106ZKevin Cr
02405AB1E240711T074131ZKevin Cr
024Charcoal240711T063055ZNeil
049Google Sheets240710T202030Zdoubleun

even for platforms that don't support UTF-8 at all this challenge can still be safely coded up via octals

awk '$0=/^(11$|8[0-9]*|[Hh]?(O|o|\703[\223\663])[^0-9]*)/?"u":"o"'

but one can always hard-code in the UTF-8 bytes instead :

awk '$0=/^(11|8[0-9]*|[Hh]?(O|o|Ó|ó)[^0-9]*)$/?"u":"o"' 

Retina 0.8.2, 26 24 bytes

Mi`^11$|^h?[8oó]
T`d`\ou

Try it online! Link includes test suite that removes the => [ou] suffix to allow the test cases to be used as input. Explanation: Port of @Arnauld's JavaScript answer.

Mi`^11$|^h?[8oó]

Count the number of occurrences of the pattern in the input.

T`d`\ou

Index that into the string ou. (o is magic in transliteration mode so it needs to be quoted to be literal. d is also magic, being a byte shorter than writing 01.)

Edit: Saved 2 bytes by porting @Fmbalbuena's golf to @Arnauld's answer.

R, 45 bytes

\(s)`if`(grepl("^h?[oó8]|^11$",s,T),"u","o")

Attempt This Online!

Port of @Arnauld's JavaScript regex answer.

Python, 64 62 60 bytes

Edit: -2 bytes thanks to @xnor and -2 bytes thanks to @squareroot12621.

lambda s:re.match("^h?[oó8]|^11$",s,2)and"u"or"o"
import re

Attempt This Online!

Port of @Arnauld's JavaScript regex answer.

Python 3.8 (pre-release),  66  55 bytes

-11 bytes by realizing that strings like 'H8' are undefined behavior.

lambda s:'ou'[s.strip('hH')[:1]in[*'oóOÓ8']or'11'==s]

The list unpacking could be removed (-3 bytes) if strings matching /^[hH]*$/g could output 'u' instead of 'o'.

Try it online!

AWK -vIGNORECASE=1, 27 bytes

$0=/^11$|^h?[oó8]/?"u":"o"

Attempt This Online!

Bash, 47 bytes

-2 bytes by @Fmbalbuena with golfed regex

grep -qiE '^h?[oó8]|^11$'<<<$1&&echo u||echo o

Attempt This Online!

use as a body of a bash function or bash script, takes input as first argument and outputs to stdout.

explanation:

grep -qiE                  <<<$1 #match on the first argument, don't output matches, case-insensitive, extended expressions
          '^h?[oó8]|^11$'        #the expression we know and love at this point
                                &&echo u||echo o #if match, output u, o otherwise.

Nibbles, 41 nibbles (20.5 bytes)

? + ? `D256 o/-.$`)$"H"$ ==$"11" "u" "o" 384fd3

Attempt This Online!

   `D256 384fd3                   # decode from base-256
                                  # to [56,79,211]
  ?                               # now get the index in this of
        o                         #   codepoint of
         /         $              #   first element of
           .$`)$                  #   input mapped to uppercase
          -     "H"               #   without any "H"s
 +                                # add this to
                    ==$"11"       #   is the input equal to "11"?
?                                 # if the answer is non-zero
                           "u"    #    output "u"
                                  # otherwise
                              "o" #    output "o"

QuadR i, 24 23 bytes

−1 thanks to Fmbalbuena.

^(11$|h?[oó8]).*
.+
u
o

Try it online!

If at the very beginning (^) we find any of the following:

then we replace it and anything that follows it (.+) with a "u".

Everything else (.+) we replace with an "o".

JavaScript (ES6), 35 bytes

-2 thanks to Fmbalbuena

s=>"ou"[+/^h?[oó8]|^11$/i.test(s)]

Try it online!

Go, 110 bytes

import."regexp"
func f(s string)string{o:="o"
if b,_:=MatchString(`(?i)^h?[oó]|^11$|^8`,s);b{o="u"}
return o}

Attempt This Online!

Uses the case-insensitive regexp that everyone else is using.

Lexurgy, 60 bytes

r:
{{{h,H}? {o,ó,O,Ó}},\8} []*=>u/$ _
\11=>u/$ _ $
[]+=>o

Explanation

r:
{{{h,H}? {o,ó,O,Ó}},\8} []*=>u/$ _ # match /[hH]?[oóOÓ]|8/ at the start of the word, and replace it all with u
\11=>u/$ _ $                       # special case for 11
[]+=>o                             # everything else is o

Ruby, 41 33 bytes

->s{s=~/^h?[oó]|^11$|^8/i??u:?o}

Attempt This Online!

Thanks to almost the same syntax, the regex is gratefully copypasted from the Arnauld's answer :D

(The following comment refers to the previous 41-byte version)

What I like here, is how three question marks appear together (alas, a space cannot be removed), each one having a different role: the first one is a part of the boolean expression that checks whether a value is nil, the second one belongs to the ternary operator and the last one is a shortcut for 'o'.

Java, 44 bytes

s->s.matches("(?i)11|(8|h?[oó]).*")?'u':'o'

Try it online.

Explanation:

s->     // Method with String parameter and character return-type
  s.matches("(?i)11|(8|h?[oó]).*")?
        //  If the String matches the full regex explained below:
    'u' //   Return 'u'
   :    //  Else:
    'o' //   Return 'o' instead

Regex explanation:

The String#matches method implicitly matches the entire String, adding a leading ^ and trailing $.

(?i)^11|(8|h?[oó]).*$
(?i)                    # Enable case-insensitive matching
    ^               $   # Match the entire string
     11                 #   It's "11"
       |                #  OR:
         8              #    It starts with an "8"
        ( |      )      #   or
           h?           #    An optional "h"
             [oó]       #    Followed by either "o" or "ó"
                  .*    #   Followed by 0 or more additional characters

05AB1E, 24 bytes

„ouIl'hæ„óoâJ8ªÅ?àI11Q~è

Try it online or verify all test cases.

Explanation:

„ou             # Push "ou"
I               # Push the input-string
 l              # Lowercase it
  'h           '# Push "h"
    æ           # Pop and push its powerset: ["","h"]
     „óo        # Push "óo"
        â       # Cartesian product to create all possible pairs:
                #  [["","ó"],["","o"],["h","ó"],["h","o"]]
         J      # Join each together: ["ó","o","hó","ho"]
          8ª    # Append 8: ["ó","o","hó","ho","8"]
            Å?  # Check for each whether the lowercased input starts with it
              à # Check if any is truthy (by leaving the maximum)
I               # Push the input-string again
 11Q            # Check whether it equals 11
~               # Check if either of the two is truthy
 è              # Use that 0 or 1 to (0-based) index into the "ou"
                # (after which the result is output implicitly)

Charcoal, 24 bytes

§uo∧⁻N¹¹⬤8oó⬤θ⌕↧θ⁺…hμι

Try it online! Link is to verbose version of code. Explanation:

     N                  Input as a number (zero if not)
    ⁻                   Subtract
      ¹¹                Literal integer `11`
   ∧                    Logical And
         8oó            Literal string `8oó`
        ⬤               All characters satisfy
             θ          Input string
            ⬤           All characters satisfy
                θ       Input string
               ↧        Lowercased
              ⌕         Does not start with
                     ι  Outer character
                 ⁺      Prefixed with
                   h    Literal string `h`
                  …     Extended to
                    μ   Inner index
§                       Index into
 uo                     Literal string `uo`
                        Implicitly print

Note that the version of Charcoal on TIO mistakenly counts ó as one byte but the version on ATO gets it right, or you can add the -x flag which produces an xxd style dump showing the correct number of bytes.

Google Sheets, 49 bytes

=if(regexmatch(A1,"(?i)^h?[oó]|^11$|^8"),"u","o")

Put the string in cell A1 and the formula in B1. Expects that the data is text strings as specified in the question (Format > Number > Plain text). Uses Arnauld's regex.

screenshot