EOF - Detecting End Of File - Tutorial
In computing, end-of-file (EOF) is a condition in a computer operating system where no more data can be read from a data source (file or stream). This situation generally arises when size/length of data source is not fixed or given indefinite number of testcases( or may be other reason). For solving these types of problem, programmer has to detect EOF. There are different techniques in various programming languages for detecting EOF.
In this tutorial your task is very simple you are given few characters as input, first you have to initialize a counter with value 1 and if you find the next coming character is 'a' (first letter in the ISO basic Latin alphabet in lowercase, having ASCII value 97) then print the value counter and increment the value of counter by 1.
Input
Few characters (one character per line).
Characters are only from a-z (lowercase Latin alphabet).
Number of lines <= 10^7+5.
Output
Few number of integers (one per line) starting from 1 in order such that next integers is just incremented value of its previous one.
Example
Input: h a r i Output: 1
Input: a a a a Output: 1 2 3 4
Input: h m p Output:
Note: Nothing is displayed in the third test case as no 'a' is found in input.
Added by: | hmp |
Date: | 2016-07-01 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |