Books published before year EASY Structuri (BAC) 10 XP 0 solved
Mobile coding works. A laptop is faster for long sessions.

Problem

Consider the data type `Carte`, defined as follows: ``` struct Carte { char titlu[60]; char autor[60]; int an; }; ``` where `titlu` and `autor` are each a single word (no spaces), and `an` is the publication year. Read from standard input a natural number `n` and a year `y`, then the data for `n` books. Print on the first line the number of books published strictly before year `y`, and on the following lines those books, in the order they were read, one per line, in the format `titlu autor an`.

Input format

Input input.txt

The first line contains `n` and `y`, separated by a space. The next `n` lines each contain the title, author, and year, separated by spaces. - `1 <= n <= 500` - `1 <= y <= 3000` - book years are natural numbers between `1` and `3000` - the title and author have at most 50 characters and contain no spaces

Output format

Output output.txt

The first line of output contains the number of books published before `y`. The following lines contain the selected books, in reading order, one per line, in the format `titlu autor an`.

Example

input
4 2000
Rascoala Rebreanu 1932
Ion Rebreanu 1920
Enigma Stanescu 2015
Baltagul Sadoveanu 1930
output
3
Rascoala Rebreanu 1932
Ion Rebreanu 1920
Baltagul Sadoveanu 1930

Ready to solve this challenge?

Create a free account to write code, submit solutions, and track your progress.

⌨️ Keyboard Shortcuts

Code Editor
Run Code
Ctrl Enter
Submit Code
Ctrl Shift Enter
Format Code
Shift Alt F
Toggle Comment
Ctrl /
Undo
Ctrl Z
Redo
Ctrl Y
Navigation
Global Search
/
Show Shortcuts
?
Close Modal
Esc

🔍 Interactive Debugger

0 / 0

Analyzing your code...

📦 Variables

No variables yet

📚 Call Stack
main() line 1
📤 Output
We use cookies

Essential cookies are always active. You can choose to enable preference and analytics cookies. Learn more