Loading problem...
A workforce directory service stores a person's primary profession and needs a compact display label for profile cards.
Table: Person
Task: For every row, create a formatted label in this exact pattern: <name>(<first_letter_of_profession>)
Examples of the required formatting:
Output requirements:
Supported submission environments:
Person:
| person_id | name | profession |
|-----------|-------|------------|
| 1 | Alex | Singer |
| 3 | Alice | Actor |
| 2 | Bob | Player |
| 4 | Messi | Doctor |
| 6 | Tyson | Engineer |
| 5 | Meir | Lawyer |[
{"person_id":6,"name":"Tyson(E)"},
{"person_id":5,"name":"Meir(L)"},
{"person_id":4,"name":"Messi(D)"},
{"person_id":3,"name":"Alice(A)"},
{"person_id":2,"name":"Bob(P)"},
{"person_id":1,"name":"Alex(S)"}
]Each output name is original name plus profession initial in parentheses. Rows are ordered by person_id descending.
Person:
| person_id | name | profession |
|-----------|--------|------------|
| 101 | A | Actor |
| 98 | Brenda | Doctor |
| 205 | Carl | Lawyer |
| 77 | Diana | Singer |[
{"person_id":205,"name":"Carl(L)"},
{"person_id":101,"name":"A(A)"},
{"person_id":98,"name":"Brenda(D)"},
{"person_id":77,"name":"Diana(S)"}
]Even when input rows are unsorted, output must be sorted by descending person_id.
Person:
| person_id | name | profession |
|-----------|-----------|------------|
| 900 | alEX | Engineer |
| 450 | maria | Player |
| 901 | Zed | Doctor |[
{"person_id":901,"name":"Zed(D)"},
{"person_id":900,"name":"alEX(E)"},
{"person_id":450,"name":"maria(P)"}
]Name text itself is preserved; only profession initial is appended inside parentheses.
Constraints