g | x | w | all
Bytes Lang Time Link
009Uiua250307T145944ZjanMakos
031Zsh & coreutils250304T102725Zroblogic
406C250304T075710ZCaydendW
066Swift 6250302T180211ZmacOSist
066AWK250228T165311Zxrs
08705AB1E250113T111210ZKevin Cr
022K ngn/k250104T024015Zatt
006Nekomata250108T023207Zalephalp
008Jelly250106T190323ZJonathan
025Arturo250106T123127Zchunes
014Pyth250102T235213ZCursorCo
108Wolfram Language Mathematica241230T080102ZIntroduc
012Brachylog250101T184907Zcjquines
034PowerShell Core241230T090405ZJulian
4268Maple241231T000422Zdharr
029R241229T215029ZEonema
152JavaScript Node.js241230T011051Zl4m2
1612J241230T104047ZJonah
025Charcoal241230T103047ZNeil
045Retina 0.8.2241230T102454ZNeil
057APL+WIN241230T085714ZGraham
009Vyxal241230T081024Zlyxal
037Perl 5 MListUtil=uniq241230T070414ZXcali
025Python241230T025042ZMukundan
011Uiua241229T201511Znyxbird

Uiua, 9 bytes, score 10

/+⊂◴°⊚⊛⟜◰

Online test cases

Explanation

/+⊂◴°⊚⊛⟜◰
       ⟜◰ # Mask of unique characters
    °⊚⊛   # Counts of each character
   ◴      # Remove duplicates
/+⊂       # Sum both lists

Zsh & coreutils, score 31

for r (${(us::)1});j+=(${(c)#1//[^$r]});bc<<<$#j+${(j:+:)${(u)j}};####=====[[[[[]]]]]^^^^^1111    ////;;;+++<<<::{{}}bbbbbccccfffffjjooooorrrsssssuuuu

Try it online!

Score: 25 unique characters + 6 of each = 31.

v1.0: score 44 (29 unique + 9 space chars + 6 others)

C, 406 bytes, score = 43

c(char*h){int r[2000]={0},*n=r+200,*a=r,f=0,t=0,o=0;for(;*h;)!r[*h++]++?f++:0;for(;t++!=200;)!n[(o=*a++)]++?f+=o:0;return f;}/*            ////////////0uuuuuuuuuuuuu!!!!!!!!!!!(((((((((())))))))))******{{{{{{{{{{{{}}}}}}}}}}}}ttttttttttrrrrrooooooooo,,,,,,,,,eeeeeeeeeeeeeffffffffnnnnnnnnnnaaaaaaaaaaahhhhhhhhhhcccccccccccciiiiiiiiiiiii22222222222::::::::::::;;;;;;=====????????????[[[[[[[[[[[]]]]]]]]]]]*/

String garbage at the end to artifically deflate the score, same idea as @Mukundan314 had.

The idea is fairly simple: count all unique characters first and how many times they occur. Then, add all unique occurance counts.

I'm 99% sure this can be golfed harder but I stop here.

Swift 6, 66 bytes, score: 36

{s in Set(s+"").count+Set(s.map{r in s.count{$0==r}}).reduce(0,+)}

AWK, 66 bytes, score 51 48

{for(f=0;i++<NF;)o[$i]++||f++;for(i in o)r[o[i]]++||f+=o[i]}1,$0=f

Attempt This Online!

{for(j=0;i++<NF;)   # iterate over string
b[$i]++             # array[unique char] count of
||j++;              # count total unique char
for(i in b)         # iterate over unique char
c[b[i]]++           # array[unique count] for each char
||j+=b[i]}          # add count of total if unique
1,$0=j              # print

05AB1E, score: 8 (7 bytes)

¢Ù`IêgO

Input as a list of characters.

Try it online or verify all test cases.

Explanation:

¢        # For each character in the (implicit) input-list, count how many times
         # it occurs in the (implicit) input-list
 Ù       # Uniquify this list of counts
  `      # Pop and push all unique counts to the stack
   I     # Push the input-list again
    ê    # Sort and uniquify it
     g   # Pop and push its length
      O  # Sum all values on the stack together
         # (after which the result is output implicitly)

ê both sorts and uniquifies at the same time. Although we don't care about the sorting part, we use it to our advantage in this challenge as a second uniquify builtin besides Ù.

K (ngn/k), 22 bytes, score 13

{(#?y)+/?#'=y}{(+/'=)}

Try it online!

              {(+/'=)}  spare characters
{   y       y}            (ignored)
        ?#'=y           unique counts
 (#?y)                  count unique
      +/                sum

Alternatively, also score 13:

{#(?y),&?#'=y}{(,&'=)}

Try it online!

Nekomata, 6 bytes, score 7

Ţᵉu#c∑

Attempt This Online!

Ţᵉu#c∑
Ţ           Tally; count occurrences of each unique element
 ᵉ          Apply the following two functions to the same argument:
  u             Remove duplicates
   #            Length
    c       Append
     ∑      Sum

There are 6 unique characters in the code, so the score is 6 + 1 = 7.

Jelly, score = 8

Seven distinct bytes -> score = 7 + 1 = 8

ĠẈL;QƊS

A monadic Link that accepts a list of characters/bytes/integers that yields the score of that list.

Try it online! Or see the test-suite.

How?

ĠẈL;QƊS - Link: list, A                  e.g. "abcaaccac"
Ġ       - group indices of {A} by value       [[1,4,5,8],[2],[3,6,7,9]]
 Ẉ      - length of each -> GroupSizes        [4,1,4]
     Ɗ  - last three links as a monad:
  L     -   length {GroupSizes} -> X          3
    Q   -   deduplicate {GroupSizes} -> Y     [4,1]
   ;    -   {X} concatenate {Y}               [3,4,1]
      S - sum {that}                          8

Arturo, 25 score

$[s][+size unique s∑unique values tally s];]nanli]eqn[a][q[laqi

Try it!

Pyth, 14 bytes, score 9

ss+{/LQQl{+Ll/

Try it online!

Explanation

ss+{/LQQl{+Ll/ddQ    # implicitly add ddQ
                     # implicitly assign Q = eval(input())
          +Ll/ddQ    # map over Q prepending some random junk to each char (this serves only to duplicate various characters in the source code)
         {           # deduplicate
        l            # take the length (gives number of unique chars in Q)
    /LQQ             # count how many times each char of Q appears in Q
   {                 # deduplicate
  +                  # append result of l to the list
 s                   # sum list to get the final result
s                    # floor result to int (does nothing)

Wolfram Language (Mathematica), 42 31 Score ( 54 108 bytes)

(Length[#]+Total@Union[Values[#]])&@*Counts@Characters@#&(*((LLLeggghh[#]+++TTTollUUUiiiVVVuus))&&*CCrrccc*)

Edit: Tweaked code to score better with a comment string added

Try it online!

Brachylog, 12 bytes, score 13

ọzt⟨dc{lg}⟩+

Try it online!

Explanation

ọ               Get counts of each letter in input.
 zt             Zip and get the last element,
                which is the list of counts.
   ⟨      ⟩+    Get the sum of:
    d             its distinct elements
     c            concatenated with
      {lg}        its length, as a list.

PowerShell Core, score 34

{sal l group;($a=$args|l).length+(($a|% count|sort|gu)-join"+"|iex);$l="`````"$%%%%(())+++----....;;;===  acccceeeghhhhiiijjjjnnopppprrssttuuxxxx"}

Try it online!

Maple, score = 42 (68 bytes)

f:=s->add({(f:=seq(numboccur([seq(s)],a),a in{seq(s)}))})+nops([f]);

numboccur counts characters of type a, where the seq maps a over the unique characters in the string s, to give f (for this program) equal to

2, 7, 7, 1, 2, 1, 2, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 3, 1, 1, 3, 2, 1, 3, 1, 7, 2, 2, 2

f is made into a set of unique character frequencies {1,2,3,7} which is added to give 13, and then we add the number of distinct characters, nops([f])=29, to give 42.

R, score 40 29

-9 thanks to @pajonk

\(m,n=utf8ToInt(m))sum(unique(n)|T,unique(table(n)))######,,,,\\\\\=====|||||88888aaaaabbbbbeeefffffiiiiIIIIIlllllmmmoooooqqqqssssstttTTTT

Attempt This Online!

JavaScript (Node.js), 152 bytes, score = 27

p=>p.split(s=t=[]||(l,lll,i|iiii,mmmmmmhh,aa,u>uu>u>u>u.u.l.litt)).map(a=>-p.split(a,s[[,a]]=s[[,a]]||--t).push()).map(h=>s[h]=s[h]||-(t-=-h-([]>h)))|-t

Try it online!

J, 16 bytes (Score = 12)

(#+/@,~.)@(#/.~)

Try it online!

Charcoal, 25 bytes, score 24

Fθ⊞υ№θιI⁺LΦθ⁼κ⌕θιΣΦυ⁼κ⌕υι

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

Fθ⊞υ№θι

Get the counts for each input character.

I⁺LΦθ⁼κ⌕θιΣΦυ⁼κ⌕υι

Add the number of deduplicated input characters to the sum of the deduplicated counts.

Retina 0.8.2, 45 bytes, score 44

$
¶$`
Dr`.\G
O`\G.
\G(.)\1*
$.&$*1¶
D`\G.+¶
.

Try it online! Link includes test cases. Explanation:

$
¶$`

Duplicate the input on a second line.

Dr`.\G

Deduplicate the characters of the copy.

O`\G.

Sort the characters of the original.

\G(.)\1*
$.&$*1¶

Get the counts (in unary) of each character.

D`\G.+¶

Deduplicate those counts.

.

Sum the counts and add on the number of deduplicated characters.

APL+WIN, 57 bytes, score 41

Prompts for string.

(⍴v)++/((n⍳n)=⍳⍴n)/n←v-¯1↓0,v←(~v=1↓v,0)/⍳⍴v←v[⍋v←⎕av⍳,⎕]

Try it online! Thanks to Dyalog Classic

Vyxal, score 9

sĠ₌L@UJ∑

Try it Online!

Explained

sĠ₌L@UJ∑­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁤‏‏​⁡⁠⁡‌⁤​‎⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌⁢⁡​‎‎⁡⁠⁢⁢‏‏​⁡⁠⁡‌⁢⁢​‎‎⁡⁠⁢⁣‏‏​⁡⁠⁡‌⁢⁣​‎‎⁡⁠⁢⁤‏‏​⁡⁠⁡‌­
sĠ        # ‎⁡Sort the input and group by consecutive characters
  ₌L@     # ‎⁢To that:
   L      # ‎⁣  Push the length of the whole list
    @     # ‎⁤  And the length of each group
     U    # ‎⁢⁡Uniquify the group lengths
      J   # ‎⁢⁢Prepend the number of unique characters
       ∑  # ‎⁢⁣And sum that
💎

Created with the help of Luminespire.

Perl 5 -MList::Util=uniq,sum -pF, 37 bytes, score 29

map$;{$_}++,@F;$_=%;+sum uniq values%

Try it online!

Python, 26 25 score

-1 score thanks to @l4m2

lambda p:sum(set(map(p.count,p)),len(set(p)))#bbbbdddd    ::::....ccccoooo,,,####lllnnnuuuaammeesstt

Attempt This Online!

Uiua, score 11

/+⊂⧻∩◴⟜°⊚⊛

Try it!

/+⊂⧻∩◴⟜°⊚⊛
           ⊛  # classify (convert to numbers)
       ⟜°⊚   # get counts, keeping original
     ∩◴       # deduplicate both
   ⧻          # take the length of the deduplicated string
  ⊂           # join it to the counts
/+            # and sum