This project processes a list of passport stamps and converts them into periods of stay in different countries.
The input consists of a list of lines in the following format:
IN RUS 08.03.18
OUT RUS 06.03.18
IN RUS 06.03.18
OUT RUS 24.03.18
...
Where:
IN
— entry into a country.OUT
— exit from a country.- Country code (
RUS
,MNE
,BIH
, etc.). - Date in the format
DD.MM.YY
.
Comments (e.g., ## PAGE 9
) may be present, and exit stamps may be missing.
After processing the stamps, the program generates periods of stay in each country:
BIH from 15.08.2023 to 19.08.2023, total days: 5
SRB from 19.08.2023 to 26.08.2023, total days: 8
BIH from 26.08.2023 to 29.08.2023, total days: 4
SRB from 29.08.2023 to 18.10.2023, total days: 51
Error: 32 days between 18.10.2023 and 18.11.2023
MNE from 18.11.2023 to 26.11.2023, total days: 9
SRB from 26.11.2023 to 14.12.2023, total days: 19
TRC from 14.12.2023 to 22.12.2023, total days: 9
- Processes stamps in any order.
- Handles missing entry/exit stamps.
- Ignores comments and non-stamp lines.
- Detects missing periods and warns about data gaps.
- Prepare a text file with a list of passport stamps.
- Run the program.
- Get a list of stay intervals in different countries.