Young Programmer and C++
Alex is a tenth grader with a keen interest in programming. After high school, he plans to pursue a degree in software engineering to become as accomplished a programmer as his father. To make the most of his time, Alex has been reading insightful books and articles about various programming languages and technologies. Through this, he discovered the vast array of programming languages available—some for system software, others for computational tasks on supercomputers, internet applications, logical problem-solving, and more. Realizing that mastering all these languages isn't feasible or necessary, Alex chose C++ as his starting point for learning programming. He quickly learned to write simple programs and even grasped the rules for input-output format operators. However, when his father reviewed his programs, he was appalled and recommended the book "Code Complete" to Alex. (We assume you've read this book too!)
After reading "Code Complete", Alex gained new insights and decided to overhaul his programming style. He became particularly attentive to the characters '\n', '\t', and '\r', which are often used in input-output formatting but can also serve other purposes. To track how frequently he uses these characters, Alex decided to write a program to count them in his code.
The task seems straightforward, but Alex has been struggling with it for three days, encountering persistent errors. Can you help by writing such a program?
Input
The input file contains the text of the program. It is guaranteed that the file contains no more than 1000 lines, and each line contains no more than 100 characters.
Output
In the output file, you should output a single number—the count of
'\n', '\t', '\r'
in the program. At the end of the program, Alex always includes a comment
//end
This comment is always placed by Alex at the beginning of the line.