Skip to content

Instantly share code, notes, and snippets.

@stmtk1
Created February 20, 2019 12:16
Show Gist options
  • Save stmtk1/ff6890d0ca1c26d7611afef1d0f24020 to your computer and use it in GitHub Desktop.
Save stmtk1/ff6890d0ca1c26d7611afef1d0f24020 to your computer and use it in GitHub Desktop.
import java.io.InputStream;
import java.io.IOException;
class MyScanner{
InputStream stream;
public MyScanner(){
stream = System.in;
}
public int nextInt(){
int ret = 0;
try{
while(true){
char readed = (char)stream.read();
if(readed < '0' || readed > '9'){
break;
}
ret = ret * 10 + (readed - '0');
}
}catch(IOException e){
e.printStackTrace();
}finally{
return ret;
}
}
}
class Main {
public static void main(String args[]) {
System.out.println("Hello world");
MyScanner sc = new MyScanner();
System.out.println(sc.nextInt());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment