ACM (UVa) : 10062


Make a structure of 105 elements …
structure {
integer ASCII_value;
integer Frequency;
} array [105]

first sort the array according to frequency in ascending order
if two frequency are same then higher ASCII value will be given the higher precedence.
Again, do not print an extra newline character at the least position.

Critical input:
AAABBBCCC
eto kotha kos ken ??
^~ shala _|\ gobet !,.

Critical output:
67 3
66 3
65 3

115 1
110 1
104 1
97 1
116 2
101 2
63 2
111 3
107 3
32 4

126 1
124 1
116 1
115 1
111 1
108 1
104 1
103 1
101 1
98 1
95 1
94 1
92 1
46 1
44 1
33 1
97 2
32 4

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s