1707 - GEC1506_QUIZ2 Scoreboard

Time

2019/06/04 13:30:00 2019/06/04 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12269 GEC1506 Encoding
12312 TF_Bottom3_Python

12269 - GEC1506 Encoding   

Description

Given a few lines of text, you need to parse it and perform the following requirements.

Hint: Please use sys.stdin instead of input() in this homework as there are multiple lines, else you will not be accepted!!!

If there are some character have same frequency, please order them according to the order of occurence.

  • For example: In sample input, 'l' and 'e' have same frequency (2). And 'e' appears beofre 'l' in the text. So in your list, 'e' should also appear before 'l'.

Input

In this assignment, a few lines of text will be given as an input.

Output

You will need to read the given input and count the frequency of each character appear in the sentences. (You don't need to encode the space character ' '. )

Then, sort (stable sort) the characters based on the frequency of the word. (from max to min) 

After sorting, you will now have a list starting from the most frequent character. You need to encode the characters.

 

Example Input:

hello john
how are you

After counting and sorting,

You will get 

'o' for 4 times

'h'  for 3 times

'e' for 2 times

  ... 

Encode:

The order of the characters will encode to alphabet according to alphabetical order (a-z).

For example,

'o' is the most frequent character, so we encode it to 'a'.

'h' is the second frequent character, so we encode it to 'b'.

followed by this rule, we can encode all our characters.

Note that the input and output below is just a sample test case.

Please DO NOT directly use it as your input.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12312 - TF_Bottom3_Python   

Description

Given a few lines of text, you need to parse it and perform the following requirements.
 
In this test, you need to find the top 3 unfrequent words.
 

If there are some words have same frequency, please order them according to the order of occurence.

Input

One or multiple lines of text

Output

Print top 3 unfrequent words from the input text

If there are many words have the same frequency, please order them according to their appearance order.

Sample Input  Download

Sample Output  Download

Tags




Discuss