Print the last line
You are asked to print the last line of the file.
The input of the program contains a single line - the name of the file.
The output of the program should contain a single line - the last line of the file. It’s guaranteed that the file contains at least a single line.
Input | input.txt | Output |
input.txt | hello this is
some file content | some file content |
Input | single.txt | Output |
single.txt | this file has only 1 line | this file has only 1 line |
Input | many.txt | Output |
many.txt | this file
has
…
many
many lines | many lines |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB