based on dodona exercise https://dodona.ugent.be/nl/exercises/668571979/ . In 1952, Dr. Virginia Apgar developed a test that allows a quick initial evaluation of a newborn baby’s general condition.
This test is performed by the obstetrician, gynecologist or pediatrician one minute, five minutes and 10 minutes after birth and provides insight into the baby’s condition on five vital criteria:
code | criterium | 0 punten | 1 punt | 2 punten |
---|---|---|---|---|
A | Ademhaling | geen | zwak | goed doorhuilen |
P | Pols- / hartslag | 0/min | < 100/min | ≥ 100/min |
G | Spierspanning / -tonus | slap | enige flexie van de ledematen | actieve beweging van de ledematen |
A | Aspect / kleur | blauw of bleek | blauw bij de extremiteiten | hele lichaam roze |
R | Reactie op prikkels | geen | enige beweging | krachtig huilen |
Write a program that calculates the APGAR score based on observations for each of the five criteria. Write a program that calculates the APGAR score based on observations for each of the five criteria. The program must immediately sound the alarm if the APGAR score is less than 4.
The input consists of five lines, with each line containing a description for one of the five criteria used to calculate the APGAR score. Each description is formed by a keyword, which corresponds to the green-colored text fragments in the table above. Descriptions that differ from the listed keywords are considered invalid. The pulse and heart rate are described by a natural number.
Write out the APGAR score corresponding to the given observations. If the score is lower than 4, write out not the score itself, but the text alarm. If at least one of the descriptions for the observations is invalid, write out the text ‘ongeldige invoer’.
Input:
goed doorhuilen
0
actieve beweging
blauw
krachtig huilen
Output:
6
Input:
zwak
110
slap
bleek
geen
Output:
alarm
Input:
zwak
99
het valt mee
roze
enige beweging
Output:
ongeldige Input