Description

You are trying to create an algorithm that recommends professions for developers if they enter their programming language and Language Preferences.

Below is a table with a Profession Language Score given to 5 languages used most in 5 professions.

Score SI CONTENTS HARDWARE PORTAL GAME
5 JAVA JAVASCRIPT C JAVA C++
4 JAVASCRIPT JAVA C++ JAVASCRIPT C#
3 SQL PYTHON PYTHON PYTHON JAVASCRIPT
2 PYTHON SQL JAVA KOTLIN C
1 C# C++ JAVASCRIPT PHP JAVA

For example, SQL's SI Profession Language Score is 3 but the CONTENTS Profession Language Score is 2. SQL's HARDWARE, PORTAL, GAME Profession Language Score is 0.

When table (an array of strings containing the Profession Language Score), languages (an array of strings that contain the languages the developer uses), and preference (an array of integers containing Language Preference) are given as parameters, create a solution function that returns the profession with the highest value of Language Preference x Profession Language Score that the developer uses.


Restrictions
  • Length of table = 5
    • table is a string in the form of "profession 5-rated-language language 4-rated-language 3-rated-language 2-rated-language 1-rated-language".profession, 5-rated-language, 4-rated-language, 3-rated-language, 2-rated-language, 1-rated-language are separated by one space.
    • table is identical in all test cases.
  • 1 ≤ Length of languages ≤ 9
    • The element of languages consists of one or more of the following: "JAVA", "JAVASCRIPT", "C", "C++" ,"C#" , "SQL", "PYTHON", "KOTLIN", "PHP".
    • The elements of languages are not used more than once.
  • Length of preference = Length of languages
    • 1 ≤ Element of preference ≤ 10
  • The i-th element of preference is the Language Preference of the i-th element of languages.
  • The string to be returned is one of the following: "SI", "CONTENTS", "HARDWARE", "PORTAL", "GAME".

Example
table languages preference result
["SI JAVA JAVASCRIPT SQL PYTHON C#", "CONTENTS JAVASCRIPT JAVA PYTHON SQL C++", "HARDWARE C C++ PYTHON JAVA JAVASCRIPT", "PORTAL JAVA JAVASCRIPT PYTHON KOTLIN PHP", "GAME C++ C# JAVASCRIPT C JAVA"] ["PYTHON", "C++", "SQL"] [7, 5, 5] "HARDWARE"
["SI JAVA JAVASCRIPT SQL PYTHON C#", "CONTENTS JAVASCRIPT JAVA PYTHON SQL C++", "HARDWARE C C++ PYTHON JAVA JAVASCRIPT", "PORTAL JAVA JAVASCRIPT PYTHON KOTLIN PHP", "GAME C++ C# JAVASCRIPT C JAVA"] ["JAVA", "JAVASCRIPT"] [7, 5] "PORTAL"

Explanation

Example #1

Calculating the scores for each profession leads to the following:

The following image is a table showing Language Preference.

tc1_preference_eg.PNG

The following image is a table showing the Profession Language Score of languages the developer prefers.

tc1_socre_eg.PNG

Therefore "HARDWARE", with the highest score of 41, should be returned.

Example #2

Calculating the scores for each profession leads to the following:

The following image is a table showing Language Preference.
tc2_score_eg.PNG

The following image is a table showing the Profession Language Score of languages the developer prefers.

tc2_preference_eg.PNG

The profession with the highest scores are "SI" and "PORTAL", with a total score of 55.
Therefore, "PORTAL" should be returned, as it comes first in alphebetical order.

Result Stop
Result of [Run] or [Submit] will be displayed here