g | x | w | all
Bytes Lang Time Link
112Swift 6240316T212437ZmacOSist
024APLDyalog Unicode250520T094610ZMat_rdv
193JavaScript V8250520T045139ZSteve Be
036Wolfram Language Mathematica190906T222042Zatt
075PowerShell Core230914T224831ZJulian
016Vyxal230913T182304Zpacman25
018Pip180301T210015ZDLosc
420Go230914T153724Zbigyihsu
088Julia 1.7221119T164316ZAshlin H
057Perl 6180825T102228ZJo King
090R190905T145319ZRobin Ry
153C gcc181126T145838Zgastropn
280Pascal FPC180824T225956ZAlexRace
030Pyth180509T212113ZRK.
1305Whispers v2180509T192318Zuser8041
116Jotlin180320T112252Zjrtapsel
008Brachylog v2180318T085304Zais523
012MATL180301T215015ZLuis Men
072APL180305T051410Zrmoro
090CoffeeScript 1180303T023415ZShieru A
096JavaScript Node.js180301T152315ZShieru A
090Retina 0.8.2180301T225908Zmbomb007
nanTSQL180302T202159ZBradC
168C gcc180301T143605ZSteadybo
088Python 2180301T142630Zovs
080Python 2180302T122750ZVincent
018Stax180301T153015ZWeijun Z
116R180301T172005ZJDL
005Java 8180301T144422ZKevin Cr
066Pyth180302T035127Zhakr14
140SmileBASIC180301T151027Z12Me21
069Python 2180302T010715ZDennis
144BASH180301T194921ZCaleb
100Perl 6180301T231926Zbb94
057Perl 5180301T213813ZTon Hosp
072Haskell180301T174315Znimi
078Ruby180301T172817ZAsone Tu
010Brachylog180301T163217ZH.PWiz
014Husk180301T145551ZZgarb
010Jelly180301T141644ZDennis
104PowerShell180301T152841ZAdmBorkB
01405AB1E180301T141341ZEmigna
012Brachylog180301T144807ZMartin E
018Brachylog180301T141806ZErik the

Swift 6, 156 124 112 bytes

39 31 28 unique, 4 of each

["."]
let
cc$={[]almpS
in{Set($0).count<1&+1&&1&<<1<=$0[+0]}((almpS+"").map{[]eiou
in(+almpS.count{$0==eiou})})}

Try it on SwiftFiddle!

The function you want is cc$(_:).

Characters Used

\n"$&()+.01<=S[]aceilmnoptu{} (where \n is a literal newline)

Notes

APL(Dyalog Unicode), 24 bytes SBCS

∧/2(≤,=/)(≢'∧2≤,=≢⌸'⊢⊢)⌸

Try it on APLgolf!

Explanation

                        ⌸   Key: applies a function for each unique element (as left argument) and their indices (as right argument)
         (            ) 
                     ⊢      Right argument
                    ⊢   
           '∧2≤,=≢⌸'       An unused string with additional characters to make the function non-discriminating
           '∧2≤,=≢⌸'⊢⊢    Function train X (A f g) Y ←→ A f (X g Y). Since both f and g are ⊢, it just returns the right argument
          ≢                 Tally (length)
         (≢'∧2≤,=≢⌸'⊢⊢)⌸ How many times each unique element appears
   (    )               
       /                    (N-wise) reduce
      =       
      =/                    For 2-wise reduction: which adjacent elements are equal
     ,                      Concatenate
    ≤
    ≤,=/                    Function train X (f g h) Y ←→ (X f Y) g (X h Y)
  2(≤,=/)                   Which elements are greater or equal than 2 end which adjacent elements are equal (this condition is redundant but short)
 /                          Reduce
∧                           And
∧/2(≤,=/)(≢'∧2≤,=≢⌸'⊢⊢)⌸ Solution: whether each element appear at least 2 times and the same number of times as others

JavaScript (V8), 193 bytes

(a,m={},p=[...a])=>p.map(p=>m[p]=(m[p]||0)+1)&&!p.find(dinf=>m[dinf]!=m[a[0]])&&m[a[0]]>1 //,,,,,,{{{{{{{}}}}}}}+++++++findfindfindfindfind||||||111111!!!!!!//////00000()()()()>>>>&&&&aaa...=mp

Try it online!

Definitely a huge amount of improvement possible, but it's a hard challenge! Simultaneously trying to reduce the number of different characters and how frequently the most common character is used.

Wolfram Language (Mathematica), 57 54 40 36 bytes

#~Max~2==Min@#&@*Counts

2*aCiostux&

Try it online!

PowerShell Core, 75 bytes

-!(($ps=$args| group |% co*|gu).count-1)*!($ps-le1)###1alnn*%=.raclette!.=%

Try it online!

Takes the input as a splatted string

Vyxal, 16 bytes

≈?Ċfy‹≈ß?Ċfy‹AßA

Try it Online!

Non-commented 16 byter

Pip, 22 18 bytes

^1>=Y^aNaYMNy=My>1

Attempt This Online!

Explanation

Each character occurs twice.

^1>=Y^aNaYMNy=My>1
      a             First command-line argument (a string)
     ^              Split into a list of characters
       Na           Count occurrences of each character in a
    Y               Yank the result into y
^1>=                No-op: compare with [1]
          MNy       Minimum of y
             =      is equal to
              My    Maximum of y
                >1  which is also greater than one
         Y          No-op: yank that result 
                    Autoprint the result of the last expression

Alternate 18-byters:

Y^!1Y^aNaMNy=My!=1
Y_<=1Y_NaMa1<Ny=My

Go, 444 420 bytes

func(s string)bool{m,c:=make(map[rune]int),make(map[int][]rune)
for _,d:=range s{m[d]++}
for o,a:=range m{if a<1+1{return 1<000000000000}
c[a]=append(c[a],o)}


//abbbbbbbbbbbcccccccdddddddddeeffffffff
//gggggggggiiiiiiiikkkkkkkkkkllllllllllmmmmmoooooo
//pppppppprssssssssstttttttuuuuuuu
//    11111111<<<<<<<<<<:::::::::
//___________+++++++++,,,,,,,======
//{{{{{{{{}}}}}}}}((((((()))))))[[[[[[]]]]]]
return len(c)==1}

Attempt This Online!

Adds characters as comments and whitespace to make it non-discriminating.

Discriminated version, 165 163 bytes

func(s string)bool{m,c:=make(map[rune]int),make(map[int][]rune)
for _,d:=range s{m[d]++}
for o,a:=range m{if a<2{return 1<0}
c[a]=append(c[a],o)}
return len(c)==1}

Attempt This Online!

Julia 1.7, 88 bytes

x->(n=-[-all([])][];t=count.(x∪x,x);all(c->c==t[n]>n,t))####,,...;;>aacooouuu∪∪∪

Attempt This Online!

Ungolfed and unrestricted version:

x -> ( chars=count.(unique(x),x); all(c->c==chars[1]>1,chars) )

The logic ensures that each character's count is equal to the count of the first character and greater than 1. Julia 1.8 includes the relevant function allequal.

Golfing in Julia:

Perl 6, 58 57 bytes

{.max==.min>()**()}o{(bag .comb){*}}###=>>abccggiinnoxx  

Try it online!

Turns out the three character version is slightly shorter than the two character one.

R, 90 bytes

"?"=`u\164f8ToI\x6Et`;'!'=prod;!{y<-xtabs(~?readLines())}%in%{z<-y[1]}&z>T##&[]>~48bEfILpu

Try it online!

Outputs TRUE for a non-discriminating string, and FALSE for a discriminating string. I have written a lot of ugly code for challenges on this site, but I think this is the ugliest so far.

45 characters, used twice each (including a few in a comment). The previous best R answer was 116 bytes, with 29 characters used 4 times each; I am posting this separately since it is substantially different.

The code is equivalent to

y = table(utf8ToInt(readLines()))
z = y[1]
all(y == z) & (z > 1)

which converts the input to a vector of integers, computes a contingency table y of the values, then checks that all counts in that table are equal to the first count, and that the first count is greater than 1.

The initial difficulty was in using only 2 pairs of brackets. This is achieved by redefining the unary functions ! and ? to be utf8ToInt and prod respectively. (I can't use all because I need the a). There are four assignments: two with = and two with <-. This means that the equality test between y and z cannot use y==z nor y-z; y%in%z comes to the rescue.

Defining these functions uses up all the possible quotes: two double quotes, two single quotes, and I'll need the two backticks in the next paragraph, so I had to resort to readLines() instead of scan(,""). (The other options, such as scan(,letters) or scan(,month.abb) all used a precious t which I couldn't spare.)

At this point, I had most of the building blocks: utf8ToInt, prod, table, readLines, %in%. Three characters appear three times in those names: ent. First, I discovered that table(foo) is equivalent to xtabs(~foo), saving the e. I can rescue the n and the t with the hex/octal code trick; the golfiest solution is to use u\164f8ToI\x6Et (in backticks) for utf8ToInt.

C (gcc), 153 bytes

f(h,a,c,f){{{{{{{char*o=f=h,*r;for(a=!h;*o;o++){for(c=!h,r=h;*r;c+=!(*r++^*o)){}f*=!!(c^!!h)*(!a+!(a^c));a=c;}(a^c^c^f^f^h)+o,a+r,o,o,+h^*r;(a=f);}}}}}}}

Try it online!

Returns address of string as truthy value, and zero as falsy.

f(
h,                              Address of string.
a,                              # instances of previous character
c,                              # instances of current character
f                               Return value
){{{{{{{                        
char*o=f=h,*r;                  Point o to string, while giving f a non-zero value.
for(a=!h;*o;o++){               Set previous char count to 0, and then traverse the string.
for(c=!h,r=h;*r;                Set current char count to 0 and r to string,
                                and start counting instances of current character.
c+=!(*r++^*o))                  Add to counter if current character matches.
{}                              Lower the amount of semi-colons
f*=                             Multiply (AND) return value with:
   !!(c^!!h)                    Is current count not 1? (Must be 2 or above.)
            *(!a+!(a^c));       AND, is previous count valid (meaning this is not the first
                                character counted), and matches current count?
a=c;}                           Previous count = current count.
(a^c^c^f^f^h)+o,a+r,o,o,+h^*r;  Spend surplus characters to make source code valid.
(a=f);}}}}}}}                   Return value.

Pascal (FPC), 288 280 bytes

35 distinct characters * 8 times

var c:char;g:array[0..222]of byte;w,v:byte;begin;repeat read(c);inc(g[ord(c)]);v:=g[ord(c)]until eof;foR w:=0to 222do if(g[w]>=2)and(g[w]<>v)oR(v<2)then v:=0;wRitE(v>0)End.,,,,,,,.....0000::<<<<<<====>>>>>[[[]]]abbbbbccddffffgghhhhhhiiilllllllnnppppppptuuuuuuuvwwwyyyyyEEEEEERRRRR

Try it online!

-8 bytes by kicking out y from the program! (See below)
Now for the reduced range of characters, but still covering printable ASCII.

This is the basic program:

var c:char;g:array[0..255]of byte;w,v,y:byte;begin;repeat read(c);inc(g[ord(c)]);v:=g[ord(c)]until eof;for w:=0to 255do if(g[w]>=2)and(g[w]<>v)or(v<2)then y:=2;write(y=0)end.

The task was juggling between number of spaces, ;s and ()s and it seems that less than 8 characters on all of them is impossible.
There are more than 8 of es and rs in the basic program, so I introduced some capital letters or I would need to increase number of occurences of other characters.

Pyth, 30 bytes

  "&8<MQSlqr{"&q1lJ{hMrSz8<1hJ

Leading spaces necessary.

Try it online!

The actual program is just &q1lJ{hMrSz8<1hJ. I just prepended the string "&8<MQSlqr{" to make it non-discriminating. But to make the string not print itself, I had to add a space, so I added 2 spaces.

&q1lJ{hMrSz8<1hJ

 q1l                (1 == len(
    J{                  J = deduplicate(
      hM                  map(lambda a: a[0],
        r  8                length_encode(
         Sz                   sorted(input())
                            )
                          )
                        )
                    )
&                     and
            <1hJ    (1 < J[0])

length_encode here (r <any> 8) takes a sequence and outputs the length of each run of the same character, ex. "aaabbcc" becomes [[3, "a"], [2, "b"], [2, "c"]].

So this takes the input, sorts it to put in length encode, and takes the first element of each list in the resulting list (e.g. the earlier example would become [3, 2, 2]). This gives a count of how many times characters occur. Then it's deduplicated (the earlier example would become [3, 2]), and J is set to that.

Then it checks if the length is 1, i.e. there is only 1 unique number of times a character occurs, and if that is > 1, i.e. >= 2.

There might be a built-in to replace rSz8 or hMrSz8 but I can't find one.

Whispers v2, 1750* 1305 bytes

> 1
> InputAll
>> ∪2
>> #2
>> #3
>> 4÷5
>> ⌊6⌋
>> L⋅7
>> Each 8 3
>> 9ᴺ
>> 2ᴺ
>> 10=11
>> 6>1
>> 12⋅13
>> Output 14














           ###########################00000000000000000000000000001111111111111111111112222222222222222222222222333333333333333333333333334444444444444444444444444445555555555555555555555555555666666666666666666666666666777777777777777777777777777788888888888888888888888888889999999999999999999999999999============================AAAAAAAAAAAAAAAAAAAAAAAAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEIIIIIIIIIIIIIIIIIIIIIIIIIIIILLLLLLLLLLLLLLLLLLLLLLLLLLLLOOOOOOOOOOOOOOOOOOOOOOOOOOOOaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccccccccccccccccccchhhhhhhhhhhhhhhhhhhhhhhhhhhhlllllllllllllllllllllllllllnnnnnnnnnnnnnnnnnnnnnnnnnnnnpppppppppppppppppppppppppppttttttttttttttttttttttttttuuuuuuuuuuuuuuuuuuuuuuuuuu÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷ᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺᴺ∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪∪⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌊⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋⌋

Try it online!

* Golfs made while explaining it. You can see the original here

Interesting task, fairly boring restriction.

Unfortunately, due to the fact that every line must start with either >> or >, this forces the number of each character to be disproportionately large. Luckily, Whispers ignores every line that doesn't match one of its regexes, all of which require the line to begin with >. Therefore we just have a large character dump at the end of the program. In addition to this, Whispers, being designed for mathematical operations, struggles when applied to a question. Overall, this means that the task is interesting to attempt, but the source code requirements are a bit boring.

If we strip all the unnecessary characters from the program, we end up with

> 1
> InputAll
>> ∪2
>> #2
>> #3
>> 4÷5
>> ⌊6⌋
>> L⋅7
>> Each 8 3
>> 9ᴺ
>> 2ᴺ
>> 10=11
>> 6>1
>> 12⋅13
>> Output 14

Try it online!

which is the part of the code we're actually interested in.

How that works

Here we conduct two key tests: the count of each is the same and the counts are greater than 1. However, the code for these two tests are shared between them, so a complete walkthrough of the program is a more effective method of explaining this.

We start with the shared code:

> InputAll
>> ∪2
>> #2
>> #3
>> 4÷5

Here, we take the input and store it on line 2 (> InputAll). We then create a nique version of that string (i.e. the input without duplicate characters). With our next two lines, we take the length of the untouched input (>> #2) and the number of unique characters in the input (>> #3). Finally, we divide the former by the latter.

Why? Let's have a look at the two inputs of aabbcc and abbaabb. With the first string, the division becomes 6÷3 = 2, and the second results in 7÷2 = 3.5. For non-discriminating strings, the result of this division is a) An integer and b) Greater than 1. Unfortunately, this also applies to some non-discriminating strings, such as abbccc, so we have to perform one more test.

>> ⌊6⌋
>> L⋅7
>> Each 8 3
>> 9ᴺ
>> 2ᴺ
>> 10=11

Note: line 6 is the result of the division.

First, we take the floor of the division, because Python strings cannot be repeated a float number of times. Then we reach our Each statement:

>> L⋅7
>> Each 8 3

3 is a reference to line 3, which contains our deduplicated input characters, so we map line 8 (>> L⋅7) over this list. Line 8 multiplies the character being iterated over by the floor of our division (>> ⌊6⌋). This creates an array of the deduplicated characters, repeated n times.

The results from our two previous strings, aabbcc and abbaabb, along with abcabc, would be aabbcc, aaabbb and aabbcc respectively. We can see that the first and last two are identical to their inputs, just with the letters shuffled around, whereas the middle one isn't (it has one less b). Therefore, we simply sort both the input and this new string, before comparing for equality:

>> 9ᴺ
>> 2ᴺ
>> 10=11

Finally, we need to check that the number of characters in the string is 2 or greater. Luckily, the division we performed earlier will always result in a value greater than 1 if a character repeats more than once, meaning we just need to assert that line 6 is greater than 1:

>> 6>1

Now we have two booleans, one for each test. They both need to be true, so we perform a logical AND (boolean multiplication) with >> 12⋅13, before finally outputting the final result.

Jotlin, 116 bytes

{c(it).map({(_,ebb)->ebb}).l{a.none({icmp_2->icmp_2<2||icmp_2!=a[0]||",,,-->>llnnoooaettt<<<!!=[[[000!]]]".l==""})}}

Full program code:

val f: (String)->Boolean =

{c(it).map({(_,ebb)->ebb}).l{a.none({icmp_2->icmp_2<2||icmp_2!=a[0]||",,,-->>llnnoooaettt<<<!!=[[[000!]]]".l==""})}}

val trues = listOf(
        "aaaa",
        "aa!1 1 !a !1",
        "aabbccddeeffgg",
        "1Q!V_fSiA6Bri{|}tkDM]VjNJ=^_4(a&=?5oYa,1wh|R4YKU #9c!#Q T&f`:sm$@Xv-ugW<P)l}WP>F'jl3xmd'9Ie\$MN;TrCBC/tZIL*G27byEn.g0kKhbR%>G-.5pHcL0)JZ`s:*[x2Sz68%v^Ho8+[e,{OAqn?3E<OFwX(;@yu]+z7/pdqUD",
        "{c(it).map({(_,ebb)->ebb}).l{a.none({icmp_2->icmp_2<2||icmp_2!=a[0]||\",,,-->>llnnoooaettt<<<!!=[[[000!]]]\".l==\"\"})}}"
)

val falses = listOf(
        "a",
        "abbaabb",
        "abc",
        "bQf6ScA5d:4_aJ)D]2*^Mv(E}Kb7o@]krevW?eT0FW;I|J:ix %9!3Fwm;*UZGH`8tV>gy1xX<S/OA7NtB'}c u'V\$L,YlYp{#[..j&gTk8jp-6RlGUL#_<^0CCZKPQfD2%s)he-BMRu1n?qdi/!5q=wn\$ora+X,POzzHNh=(4{m`39I|s[+E@&y>"
)

for (t in trues) {
    val r1 = f(t)
    if (!r1) throw AssertionError("'$t' gave the wrong value, ($r1 != true)")
}
for (t in falses) {
    val r1 = f(t)
    if (r1) throw AssertionError("'$t' gave the wrong value ($r1 != false)")
}

Uses a check for lowercase equaling an empty string to get rid of extra characters.

Brachylog v2, 8 bytes (in Brachylog's character set)

oḅ\k\koḅ

Try it online!

Looks like there's been a golfing war going on on this question in Brachylog, so I thought I'd join in, saving a couple of bytes over the next best answer.

This is a full program that takes input as a list of character codes. (This is partly because Brachylog appears to have some very bizarre bugs related to backslashes in strings, and partly because the \ command doesn't work on lists of strings.)

Explanation

oḅ\k\koḅ
o          Sort {standard input}
 ḅ         Group identical adjacent values
  \        Assert rectangular; if it is, swap rows and columns
   k       Delete last element
    \      Assert rectangular; (rest of the program is irrelevant)

The koḅ at the end is irrelevant; k will always have an element to act on and o and cannot fail if given a list as input.

The reason for the starting oḅ should be clear; it partitions the input list by value, e.g. [1,2,1,2,4,1] would become [[1,1,1],[2,2],[4]]. In order for each character to appear the same number of times, each of these lists must be the same length, i.e. the resulting list is a rectangle. We can assert this rectangularity using \, which also transposes the rows and columns as a side effect.

We now have a current value consisting of multiple copies of the character set, e.g. if the input was [4,2,1,2,4,1] the current value would be [[1,2,4],[1,2,4]]. If we delete a copy, the resulting matrix is still rectangular, so we can turn it back using \. However, if the reason the matrix was rectangular was that all the input characters were distinct, the resulting matrix will have no elements left, and \ does not treat a "0×0" matrix as rectangular (rather, it fails). So oḅ\k\ effectively asserts that each character that appears in the input appears the same number of times, and that number of times is not 1.

That's the entire functionality of our program (as a full program, we get true if no assertion failures occurred, false if some did). We do have to obey the source layout restriction, though, so I added an additional koḅ that has no purpose but which cannot fail (unlike \, o and are happy to act on empty lists).

MATL, 12 bytes

q&=sqt&=tsvv

The input is a string enclosed in single quotes. Single quotes in the string are escaped by duplicating.

The output is a non-empty matrix, which is truthy if it doesn't contains zeros, and is falsy if it contains at least a zero.

Try it online! Or verify all test cases, including the standard truthiness/falsiness test for convenience.

How it works

Statements marked with (*) are neither necessary nor harmful, and have been included only to make the source code non-discriminating.

q     % Implicit input. Convert chars to code points and subtract 1 from each (*)
&=    % Square matrix of all pairwise equality comparisons
s     % Sum of each column. Gives a row vector
q     % Subtract 1 from each value. An entry equal to 0 indicates the input string
      % is discriminating because some character appears only once
t     % Duplicate
&=    % Square matrix of all pairwise equality comparisons. An entry equal to 0
      % indicates the input string is discriminating because some character is
      % more repeated than some other
t     % Duplicate (*)
s     % Sum of each column (*) (all those sums will be positive if the previous
      % matrix doesn't contain zeros)
v     % Vertically concatenate the matrix and the vector of its column sums
v     % Vertically concatenate the resulting matrix with nothing (*)
      % Implicit display

APL, 19 72 bytes

This is my second attempt at golfing and also second program in APL. I cant figure out if I can do an unnamed lambda within a named function. If I can do that I can shave some bytes and make it more readable. Was happy to land on a solution so quick #I♥APL

i ← ⍞ ◊ 2 ≤ ∨ / { ⍴ i ∩ ⍵ } ¨ ∪ i[⍋i]

i←{⍞}◊{}◊{}◊◊2≤∨/∨/∨/∨/{∪⍴i∩∪⍵}¨∪i[∪⍋i]⍝⍝⍝⍝⍞⍞⍞←←←222≤≤≤¨¨¨∩∩∩⍴⍴⍴⍵⍵⍵[[[]]]⍋⍋⍋

Try Apl Online Note you will need to change ⍞ to your string as character input is not supported in the online platform

Explination

Basically it gets character input and saves as i then sorts i and makes a list of the number of occurances of each unique element in i then it reduces the list with a logical or to check that there are the same number of each unique element and finally checks if there are at least 2 of each unique element.

Feel free to tear into my solution! I need to learn and I am still very new to APL and golfing.

Edit!!!

I am an idiot (as was kindly pointed out in the comments) and forgot to make my program non-deterministic. FAIL.

quack!

CoffeeScript 1, 96 93 90 bytes

(q,a=q.split(h).length-1for h in[q][0])->a.every (w,s,pplitnggffoorsvvyy)->w>1&&a[0&10]==w

Try it online!

Started from my ES6 answer but walked back to using Array.every. 32 31 30 tokens @ 3 each

JavaScript (Node.js), 144 ... 100 96 bytes

o=>!(a=o.split``.map(i=>o.split(i||aeehhhlmmnnnpst)[`length`]-1)).some(g=>![g>1][-!1]||a[-!1]-g)

Try it online!

24 different characters * 6 times each

28 different characters * 5 times each

27 different characters * 5 times each

27 different characters * 4 times each

26 different characters * 4 times each

25 different characters * 4 times each

24 different characters * 4 times each

Explanation

o=>!(
 a=o.split``.map(                            // Split the input into character array and
  i=>o.split(i||aeehhhlmmnnnpst)[`length`]-1 // count the occurrences of each character.
 )
).some(                                      // Then check
 g=>![g>1][-!1]                              // If each character appears at least twice
 ||a[-!1]-g                                  // and the counts are all the same number.
)                                            

More to add:
1. Using {s.split``} instead of {[...s]} is to reduce the number of {.} that dominates
   the count.
2. Using {!c.some} instead of {c.every} to reduce the number of inefficient characters 
   (v,r,y in every)
3. Still one unavoidable inefficient character left ({h}).

Update:
1. Got rid of one {.} by replacing {.length} by {["length"]}.
2. Got rid of one {=} by replacing {c[-!1]!=g} by {c[-!1]-g}.
3. Got rid of one {()} by replacing {!(g>1)} by {![g>1][-!1]}.
4. Finally, because count per character is now 4, the backslashes can be taken out.

Update:
1. Got rid of all {"} by replacing {"length"} by {`length`} and exploiting shortcut
   evaluation. 
   {aaaeehhhlmmnnnpst} is not defined but is not evaluated either because of {c} which
   must be evaluated to true.

Update:
1. Got rid of all {c} by shortcutting the undefined variable at {split(i)} and replacing 
   all {c} by {a}.
   Since {i} is never an empty string, it is always evaluated true (except compared 
   directly to true).

Update:
1. Got rid of all {,} by moving the assignment after the argument list. The {()} at the
   front can therefore be moved to the assignment, retaining same number of {()}s.

Retina 0.8.2, 168 90 bytes

The output will be empty if false, or non-empty if true.

***???;;;;```!!$$$$MMMMOOOO..1111ssss222{{{{\^^^^

s;{O`.
M!*\`^((.)\2(?!\2))*$
(.)(?!\1)

Try it online

Core program (39 bytes)

s;{O`.
M!*\`^((.)\2(?!\2))*$
(.)(?!\1)

Explanation

The entire core program is in a silent loop. The first stage sorts the input. The second stage will print the current string if it consists of successive pairs of different characters. The third stage removes the last occurrence of every character (removing one of each character in the string).

About the junk at the top: the order is important. In addition to needing to be syntactically valid, a semicolon must be after the asterisks and before the backticks, so long as * is in the config string, in order for it to not print.

T-SQL, 320 bytes (32 chars x 10 each)

Input is via pre-existing table FILL with varchar field STEW, per our IO standards.

WITH BUMPF AS(SeLeCT GYP=1
UNION ALL
SeLeCT GYP+1FROM BUMPF
WHeRe GYP<=1000)SeLeCT
IIF(MIN(WAXBY)<MAX(WAXBY)OR
MAX(WAXBY)<=1,+0,+1)FROM(SeLeCT
WAXBY=COUNT(1),WHICH=+1+0,HEXCHANGE=+01,HUNG=+0+1,CHLUB=+0,GEFF=+0FROM
BUMPF,FILL WHERE
GYP<=LEN(STEW)GROUP BY
SUBSTRING(STEW,GYP,1))CHEXX
OPTION(MAXRECURSION 0)----------<<<<<<

I have never been more pleased, yet horrified, by a piece of code.

Must be run on a server or database set to a case-sensitive collation. There are 10 each of 32 different characters, including upper and lowercase E (SQL commands are case-insensitive, so flipped a few as needed), spaces and tabs (tabs are shown as line breaks in the code above, for readability).

I found ways to include 10 each of the other symbols + = , in the code, but unfortunately couldn't find a way to do that with <, so I had to add the comment character -.

Here is the formatted code before I crammed in all the extra filler:

WITH b AS (SELECT g=1 UNION ALL SELECT g+1 FROM b WHERE g<1000)
SELECT IIF(MIN(w)<MAX(w) OR MAX(w)<1+1,0,1)
FROM(
    SELECT w=COUNT(1), --extra constant fields here are ignored
    FROM b, fill
    WHERE g < 1+LEN(stew)
    GROUP BY SUBSTRING(stew,g,1)
)a OPTION(MAXRECURSION 0)

The top line is a recursive CTE that generates a number table b, which we join to the source string to separate by character. Those characters are grouped and counted, and the IIF statement returns 0 or 1 depending on whether the input string is non-discriminating.

C (gcc),  333  168 bytes

Thanks to @Kevin Cruijssen for saving 9 bytes and thanks to @Laikoni for saving 45 bytes!

f(r,h,a){char*o=r,c[222]={!o};for(a=!o;*o;)++c[*o++];for(h=!o;222/++h;c[h]&&c[h]!=a&&(a=!*c))!a&&c[h]&&(a=c[h]);r=!(2/2/a);}/////!(())****++,,,,,[[]]fffffrr{{{{{{}}}}}}

Try it online!

C, 333 bytes

i,v;f(S){char*s=S,L[128]={0};for(v=0;*s;)++L[*s++];for(i=-1;++i<128;L[i]&&L[i]-v?v=-1:0)!v&&L[i]?v=L[i]:0;return-v<-1;}/////////!!!!!!!!&&&&&(((((())))))******+++,,,,,,,----00000111122222228888888:::::::<<<<<<<===???????LLLSSSSSSS[[[]]]aaaaaaaacccccccceeeeeeeeffffffhhhhhhhhiinnnnnnnnooooooorrrrssssssttttttttuuuuuuuuvv{{{{{{{}}}}}}}

Even the bytecount is non-discriminating!

Try it online!

Python 2, 108 104 92 88 bytes

-12 bytes thanks to Rod
-4 bytes thanks to Kevin Cruijssen

s=input();c=s.count;print[all(c(s[[]>[1]])==c(o)>1. for o in s)];aaafffillpprrtuu>1.>1.;

Try it online!

Python 2, 84 80 bytes

x=input()
c=map(x.count,x)
print max(c)==min(c)>1
1. or our>ram>>utopia,
1., 1.,

Try it online!

Stax, 26 24 18 bytes

:u{m*_{y#m:u_hy#h*

Try it online!

Shortest solution so far that only uses printable ASCIIs Beaten by MATL.

Guess I was approaching the problem the wrong way. Repeating a working block is neither golfy nor interesting. Now at least it looks better ...

Explanation

:u{m* produces some garbage that does not affect the output.

_{y#m:u_hy#h*
_{y#m           map each character to its number of occurences in the string
     :u         all counts are equal (result 1)
       _hy#     get the count of appearance for the first character
           h    halve it and take the floor, so that 1 becomes 0(result 2)
            *   multiply the two results

R, 132 116 bytes

crudcardounenforceableuploads<-function(b){{pi&&pi[[1-!1]];;;"";{1<{f<<-table(strsplit(b,"",,,)[[1]])}}&&!!!sd(-f)}}

It doesn't contain any comments or superfluous strings, either, though this will probably be my only time in code golf calling a function crudcardounenforceableuploads. There's probably a great anagram in there somewhere for the function name!Thanks to John Dvorak for pointing out a nice anagram solver, which I used for the name.

Character table:

- , ; ! " ( ) [ ] { } & < 1 a b c d e f i l n o p r s t u 
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4

examples:

> crudcardounenforceableuploads("aaabbbccc")
[1] TRUE
> crudcardounenforceableuploads("aaabbbcc")
[1] FALSE
> crudcardounenforceableuploads("abc")
[1] FALSE
> crudcardounenforceableuploads("crudcardounenforceableuploads<-function(b){{pi&&pi[[1-!1]];;;\"\";{1<{f<<-table(strsplit(b,\"\",,,)[[1]])}}&&!!!sd(-f)}}")
[1] TRUE

Java 8, 198 192 186 174 168 165 160 bytes (char-count 6 5)

o->{byte x[]=new byte[+333-3|2],u=-0,i,fe,fi,w; s:w:no0r3sswwyyy:for(int s:o){{u=++x[s];}};for(int b:x){if(!!!(2>b||u==b)|2>u|2>2){x[0]++;}}return!!(0>--x[0]);}

Try it online.
Code used to verify the occurrences of the characters, which was my answer for this challenge.

-5 bytes thanks to @OlivierGrégoire again by getting rid of the comment and making a mess. ;)

Old 168 bytes (char-count 6) answer:

o->{int w[]=new int[2222],u=0,f=0;for(int r:o)u=++w[r];for(int e:w)if(!(2>e|u==e)|2>u)f++;return!(f>0);}//[[[]]]  !!!!e(i)++,,,,-----oo////000tuww::::{{{{{;;||||}}}}}>>

Try it online.
Code used to verify the occurrences of the characters excluding comment, which was my answer for this challenge.

-6 bytes thanks to @OliverGrégoire removing < by swapping the checks to >.

Explanation of the base golfed program (98 bytes):
Try it online.

s->{                     // Method with character-array parameter and boolean return-type
  int a[]=new int[256],  //  Occurrences integer-array containing 256 zeroes
      t=0,               //  Temp integer, starting at 0
      f=0;               //  Flag integer, starting at 0
  for(int c:s)           //  Loop over the input
    t=++a[c];            //   Increase the occurrence-counter of the current character
                         //   And set the temp integer to this value
  for(int i:a)           //  Loop over the integer-array
    if(i>1               //   If the value is filled (not 0) and at least 2,
       &i!=t             //   and it's not equal to the temp integer
       |t<2)             //   Or the temp integer is lower than 2
      f++;               //    Increase the flag-integer by 1
  return f<1;}           //  Return whether the flag integer is still 0

Some things I did to reduce the amount of characters used:

What I did to reduce the char-count 6 to 5:

What @OlivierGrégoire did to get rid of the comment, and therefore the 5x /:

Pyth, 66 bytes

 " &&))//0<<==??@@IIJNNVVaallqq{"zJ.{zVJ=aY/zN)I&q1l.{Y<1@Y01.?0 "

Try it online!

Pyth (indented) | Python 3 (translation)
                                  | def a(A,B):
                                  |     c=list(A)
                                  |     c.append(B)
                                  |     return c
                                  | Y=[]
                                  | z=input()
 " &&))//0<<==??@@IIJNNVVaallqq{" | " &&))//0<<==??@@IIJNNVVaallqq{"
z                                 | print(z)
J.{z                              | J=set(z)
VJ                                | for N in J:
    =aY/zN)                       |     Y=a(Y,z.count(N))
I&q1l.{Y<1@Y0                     | if 1==len(set(Y)) and 1<Y[0]:
    1                             |     print(1)
.?                                | else:
    0                             |     print(0)
     "                            |     ""

SmileBASIC, 164 152 148 140 bytes

DeF M(X)DIM W[#R]WHILE""<X
INC w[ASC(x)]X[n]=""wEND
FOR F=e#TO--nOT-LEN(W)U=w[F]H=H||U&&U<MAx(W)neXT-!!!AASSS#&&Oxx||CCLL<<wIM#
RETURN!H
enD

35 different characters, repeated 4 times each.

No comments were used (but the expression after neXT is never actually evaluated)

Script to check answers:

//javascript is a convenient language that I love using!
var input=document.getElementById("input");
var button=document.getElementById("button");
var output=document.getElementById("output");

button.onclick=function(){
  var text=input.value;
  var freqs={};
  for(var i=0;i<text.length;i++){
    var letter=text.charAt(i);
    if (freqs[letter]==undefined) freqs[letter]=0
    freqs[letter]++
  }
  sorted=Object.keys(freqs).sort(function(a,b){return freqs[b]-freqs[a]})
  var out="";
  var min=Infinity,max=0;
  for (var i in sorted) {
    var letter=sorted[i];
    var count=freqs[letter];
    if(count<min)min=count;
    if(count>max)max=count;
    out+="\n"+letter+":"+count;
  }
  output.textContent="min:"+min+"\nmax:"+max+"\nunique:"+sorted.length+"\nlength:"+text.length+out;
}
<textarea id="input" placeholder="code here"></textarea>
<button id="button"butt>count</button>
<pre id="output">...</pre>

Python 2, 75 69 bytes

def f(s):len({2<<s.count(c)-2for c,in s})<2or{{e.dil:-tu,r.dil:-tu,}}

Output is via presence or absence of an error. The error is either a ValueError (one or more characters occur only once) or a NameError (the character counts are unequal).

Try it online!

BASH 144 bytes

grep -o .|sort|uniq -c|awk '{s=$1}{e[s]=1}END{print((s>1)*(length(e)==1))}##>>>#|'#wwwuuutrqqqppooNNNnlllkkkiihhhggEEEDDDcccaaa1***{}[[[]]]...--''

This line of code takes an stdin string as input. "grep -o ." puts each character on a new line. "uniq -c" counts each chacter's usage. The awk script creates an array with each usage as a different element, and outputs true when there is only 1 array index and the value is at least 2. Each character is used 4 times, so this source returns true

Perl 6, 132 100 bytes

my &f={{$_[0]>1&&[==] $_}(.comb.categorize({$_}).values)}#myy ff[]00>>11()cobbattggrriizzvvlluuss##

Perl 5, -p 57 bytes

Each character appears 3 times. Only a single 1 doesn't do anything

12 bytes added to a basic 45 character solution to make in non-discriminating

s{.}[@m[@1{$&}+=$.].=g]eg;$\=s()(e@m;1)&&m[e(\sg+)\1+;]}{

Try it online!

Haskell, 90 75 72 bytes

a[i]|d:n<-[[i|n<-i,n==a]|a<-i]=and[[i]<d,[d|i<-n]==n]--aadd,,,,:::::<=||

Each character appears 6 times. The input string is taken as a singleton list.

Try it online!

For reference, old versions:

75 bytes, each char 5 times

n(l)|d<-[[0|n<-l,n==a]|a<-l]=and[[0]<d!!0,all(==d!!0)d]--an!((())),,,0<[]||

Try it online!

90 bytes, each char 3 times:

a x|h:u<-[sum[1|d<-x,not(d/=c)]|c<-x],"  \"\\&,../1::>acdlmmnosst">[]=h>1&&all(not.(/=h))u

Try it online!

Ruby, 87 78 bytes

c=->m{y=m.chars;x=y.map{|d|y.count d}|[];x[-1]>1and not x[1]};->{pushrortpush}

26 characters repeated 3 times each

Try it online!

Brachylog, 10 bytes

=ᵍbᵐbᵐlᵍ=l

Try it online!

Explanation

=ᵍ                Group all equal elements together
  bᵐbᵐ            Remove the first element of each group twice. This fails if
                  there are fewer than 2 elements
      lᵍ          Group elements together that have the same length
        =         Are all elements of that list equal? This only succeeds if the
                  list has one element
         l        Length. This will always succeed

Husk, 14 bytes

§<ε#εu§m#u
m
<

Try it online!

Explanation

The two short lines are no-ops, since the main function never calls them.

§<ε#εu§m#u  Implicit input, say S = "asasdd"
         u  Remove duplicates: "asd"
      §m#   For each, get number of occurrences in S: [2,2,2]
     u      Remove duplicates: L = [2]
   #ε       Number of elements in L that are at most 1: 0
  ε         1 if L is a singleton, 0 otherwise: 1
§<          Is the former value smaller than the latter?

Jelly, 18 16 12 10 bytes

Ġ¬zḊḊ¬zĠȦȦ

Try it online!

How it works

Ġ¬zḊḊ¬zĠȦȦ  Main link. Argument: s (string)

Ġ           Group the indices of s by their corresponding elements.
            "abcba" -> [[1, 5], [2, 4], [3]]

 ¬          Take the logical NOT of each 1-based(!) index.
            [[1, 5], [2, 4], [3]] -> [[0, 0], [0, 0], [0]]

   Ḋ        Dequeue; yield s without its fist element.
            "abcba" -> "bcba"

  z         Zip-longest; zip the elements of the array to the left, using the
            string to the right as filler.
            ([[0, 0], [0, 0], [0]], "bcba") -> [[0, 0, 0], [0, 0, "bcba"]]

    Ḋ       Dequeue; remove the first array of the result.
            This yields an empty array if s does not contain duplicates.
            [[0, 0, 0], [0, 0, "bcba"]] -> [[0, 0, "bcba"]]

    ¬       Take the logical NOT of all zeros and characters.
            [[0, 0, "bcba"]] -> [[1, 1, [0, 0, 0, 0]]]

      Ġ     Group.

     z      Zip-longest. Since all arrays in the result to the left have the same
            number of elements, this is just a regular zip.
            [[1, 1, [0, 0, 0, 0]]] -> [[1], [1], [[0, 0, 0, 0]]

       Ȧ    Any and all; test if the result is non-empty and contains no zeroes,
            at any depth. Yield 1 if so, 0 if not.
            [[1], [1], [[0, 0, 0, 0]] -> 0

        Ȧ   Any and all.
            0 -> 0

PowerShell, 104 bytes

($qe=$args[0]| group |sort count|% count)[0]-eq$qe[-1]-and$qe[0]-gt1####((()))%%%pppddd===aaccss11nu|0gr

Try it online!

This was great fun to golf. The limitation was $, which we need four of at minimum (one for the input $args, one for assigning the computation result $qe, one for checking the last character $qe[-1] and one for checking the first character $qe[0], so that was the working maximum number of characters.

From there, it was a matter of golfing (and not-golfing, like having a two-letter variable name) to get the program nicely divisible by four. Note that we have a small comment (everything following the #) to account for some missing elements, but I tried to keep the comment as small as possible.

05AB1E, 20 18 16 14 bytes

S¢Z≠sË*sZ¢≠SË*

Try it online!

The program is essentially divided into 2 parts where the goal of the first part is to do the actual task and the goal of the second part is to use the same functions as the first part without altering the result.

Explanation (first part)

S          # push input split into list of chars
 ¢         # count the occurrence of each char in input
  Z≠       # check that the max count is not 1
    sË     # check if all counts are equal
      *    # multiply

Explanation (second part)

s          # swap input to top of stack
 Z¢        # count the number of occurrences of the largest element
   ≠       # check that the count isn't 1
    SË     # split into list and check that each element are equal (always true)
      *    # multiply (as it is with 1, the original result is left unchanged)

Brachylog, 14 12 bytes

ọtᵐℕ₂ᵐ==tℕ₂ọ

Try it online!

Explanation

ọ   Occurrences. Gives a list of [char, count] pairs for the entire input.
tᵐ  Map "tail" over this list, giving each character count.
ℕ₂ᵐ Make sure that each count is at least 2.
=   Make sure that all counts are equal.
    At this point we're done with the actual code, but we need another copy
    of each character (except ᵐ). We can just put them after this, as long as
    we make sure that they can never cause the predicate to fail.
=   Make sure that all counts are equal, again...
t   Extract the last count.
ℕ₂  Make sure that it's at least 2, again...
ọ   Get the digit occurrences in that count, this can't fail.

Alternative 12-byte solution that reuses t instead of :

ọtᵐ==tℕ₂ℕ₂ọᵐ

Brachylog, 18 bytes

oḅlᵐ=h≥2
oḅlᵐ=h≥2

Try it online!

Unfortunately, I can't remove the linefeeds, since on a number triggers a fail.