hacker rank java 9th question solution

9. Java end of file


import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner sn =new Scanner(System.in);
 
   
     
     for(int i=1;sn.hasNext()==true;i++){
      System.out.println(i+" "+sn.nextLine());
      }
    }
}



Compiler Message
Success
Input (stdin)Download
eqi wulp maq
qni d
m gugdsulk
i f
ds j
s
b e xfn
cb
g bukc
hf wuoo imv g
f su ia twh h
e te wr ord
sk f e j
q
glo v s
s x deuwqj
u
gd upf mxdh h
mrcw nx wx
bvk wiq{-truncated-}
Download to view the full testcase
Expected OutputDownload
1 eqi wulp maq
2 qni d
3 m gugdsulk
4 i f
5 ds j
6 s
7 b e xfn
8 cb
9 g bukc
10 hf wuoo imv g
11 f su ia twh h
12 e te wr ord
13 sk f e j
14 q
15 glo v s
16 s x deuwqj
17 u
18 gd upf mxdh h
19 mrcw nx wx
20 bvk wiq{-truncated-}
Download to view the full testcase


Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions