185k views
1 vote
How many characters does the "short text" have?

User Gnampf
by
5.5k points

1 Answer

3 votes

Answer:

Total number of characters in "short text" is 10.

Total number of distinct characters is 8.

Step-by-step explanation:

List of characters in "short text":

s,h,o,r,t, ,t,e,x,t - 10

Set of distinct characters is:

s,h,o,r,t, ,e,x - 8

The length can be determined programmatically in Java using String.length() api.To determine distinct characters, individual characters can be added to a Set and then the set size can be computed.

User GvM
by
5.7k points