Practice
Output Array Contents Until Data Ends
2024/May/June·Variant 2
MEDIUMArrays
Array Names can hold up to 10 strings, but it might not be completely full — any unused slot holds the empty string "". Add code that outputs the stored names, stopping as soon as it reaches the first empty slot (or the end of the array, whichever comes first).
Input: 10 strings (some may be empty, representing unused slots). Output: Each non-empty name up to the first empty slot, one per line.
Example:
Input: Amy
Bo
Cy
(7 blank lines)
Output: Amy
Bo
Cy
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Stops at the first blank slot
Inputs: Amy, Bo, Cy, , , , , , ,
Expected: Amy
Bo
Cy
Test 2: No blanks — the whole array prints
Inputs: A, B, C, D, E, F, G, H, I, J
Expected: A
B
C
D
E
F
G
H
I
J