Back
Close

Dev friends

Statement

 Goal

You are a young dev, and you have just made a few dev friends. You know each of their coding style, and are able to recognize which one wrote a given piece of code. You are given the writing particularities of each of your friends, and a code. Output who is the author.

Here are the possible tics/particularities (a true and a false example are given):
':' Puts a space before each colon (example: True: 'if cond :' / False: 'if cond:')
'if' Puts the conditions between parenthesis ('if (cond)' / 'if cond')
't' Uses 1-space indentation (other friends will put 2 or 4 spaces)
'n' Puts an empty line between each line
'#' Puts a whole documented line between each line ('#documented line' / 'not a #documented line')
'5#' Puts 5 entirely documented lines at the beginning of the code
Documented lines begin with either # or //, and a code contains only one type of comment.
Input
First line: an integer n for the number of your friends
Second line: an integer c for the length of the code (in lines)
Next n lines: a string. The name of your friend, and x particularities (1⩽x<6), space separated. (total length of the line ⩽80)
Next c lines: code (length of each line ⩽80)
Output
One string, the name of the author
Constraints
For each friend, if he has a tic, he will ALWAYS do it. On the contrary, if he doesn't have the tic, he won't always do it (this does not mean never). Then he will be the author only if each of his tics matches the code.
Friends may not have the same number of particularities.
Every code contains at least one indented line.
Each test and validator has one and only one possible solution.
Example
Input
4
10
Donatello t
Leonardo 5#
Michelangelo #
Rafaelo if
name = "Picasso"
if name.is_italian():
 print("Part of the team, mate !")
else :
 print("I don't know you")
# Picasso knocks Donatello out
# Leonardo punches Picasso's head
# This is why Picasso doesn't see very well
# I hope you don't think Leonardo did this
# Because this comments are at the end
Output
Donatello

Tags
StringsString manipulation

Difficulty
Medium

Test cases
Turtles Test
Input
4 10 Donatello t Leonardo 5# Michelangelo # Rafaelo if name = "Picasso" if name.is_italian(): print("Part of the team, mate !") else : print("I don't know you") # Picasso knocks Donatello out # Leonardo punches Picasso's head # This is why Picasso doesn't see very well # I hope you don't think Leonardo did this # Because this comments are at the end
Output
Donatello

Turtles Validator
Input
4 10 Donatello t Leonardo 5# Michelangelo # Rafaelo : name = "El greco" if name.is_italian() : print("Part of the team, mate !") else : print("I don't know you") # El greco knocks Donatello out # Leonardo kills El greco's # This is why El greco is not very famous # I hope you don't think Leonardo did this # Because this comments are at the end
Output
Rafaelo

Italian Test
Input
6 18 Paganini t Vivaldi : Rossini if Verdi n Scarlatti # Monteverdi 5# name = "Nono" if name[-1]=='i': print("Italian, mate !") elif name[-1]=='o': print("maybe you are italian, or maybe spanish") else: print("I don't know you, sorry") // This is the last one with italy and with python, I promise. (Luigi Nono is an actual italian artist)
Output
Verdi

Italian Validator
Input
6 20 Paganini t Vivaldi : Rossini n Verdi if Scarlatti # Monteverdi 5# # # Gesualdo is # an actual # italian artist # name = "Gesualdo" if name[-1]=='i': print("Italian, mate !") elif name[-1]=='o': print("maybe you are italian, or maybe spanish") else: print("I don't know you, sorry") # This is the last one with italy, I promise.
Output
Monteverdi

2 Particularities Test
Input
3 6 A # 5# B if : C t n Lorem ipsum Dolor sit amet if (Lorem_ipsum) : Dolor sit amet # Lorem # ipsum
Output
B

2 Particularities Validator
Input
3 7 F # 5# B if : A t n Lorem ipsum Dolor sit amet if Lorem_ipsum : Dolor sit amet
Output
A

Solo dev Test
Input
1 8 SOLOOOO t I'm a poor lonesome dev I'm a long long way from home And this poor lonesome cowboy Has got a long long way to roam Over mountains over prairies From dawn till day is done My horse and me keep riding Into the setting sun
Output
SOLOOOO

Solo dev Validator
Input
1 16 Lonesome n # #I'm a poor lonesome dev # I'm a long long way from home #And this poor lonesome cowboy # Has got a long long way to roam #Over mountains over prairies # From dawn till day is done #My horse and me keep riding # Into the setting sun
Output
Lonesome

Solution language

Solution

Stub generator input