FLAMES — popular game named after the acronym: Friends, Lovers, Affectionate, Marriage, Enemies, Brother and Sister. This game cannot accurately predict if a person is right for you or not, but it can be fun to play this game with your friends.
There are two steps in this game:
- Get score:
- Take two names.
- Remove common characters with their corresponding common cases.
- Get the number of characters that remained.
Get the result:
- Take the letters FLAMES as ["F", "L", "A", "M", "E", "S"]
- Start deleting the email using the amount we received.
- The email that completes the process is the result.
Example:
Input: player1 name: AJAY player 2 name: PRIYA Output: Relationship status: Friends
Explanation: In the above two names A and Y — common letters that occur once (common count) in both names, so we remove those letters from both names. Now count the total number of letters left here. Now start deleting letters one by one from FLAMES using the counter we got and the letter that lasts the whole process is the result.
The counting is done in a counter-clockwise circle.
FLAMES
counting is start from F, E is at 5th count so we remove E and start counting again but a this time start from S.
FLAMS
M is at 5th count so we remove M and counting start from S.
FLAS
S is at 5th count so we remove S and counting start from F.
FLA
L is at 5th count so we remove L and counting start from A.
FA
A is at 5th count so we remove A. now we have only one letter is remaining so this is the final answer.
F
So, the relationship is F ie Friends.
Approach: take two names as input, then remove the common characters with their corresponding common occurrences. To remove the target, we create a custom function remove_match_char
with two arguments, such as remove_match_char
and list2, which stores a character list of the two players’ name respectively and returns a linked list list (list1 + "* "Flagst2) and the flag value we store in the ret_list variable. After removing all common characters, count the total. from the remaining characters, then create a list of results abbreviated as FLAMES, that is, [Friends, Love, Love, Marriage, Enemy, Brothers and Sisters]]. Now start deleting the word one by one until the list only contains one word using the total we got. The word that remains in the latter is the result.
Below is the implementation:
|
Logout: < / p>
Player 1 name: ANKIT Player 2 name: DEEPIKA Relationship status: Marriage