Skip to content

Instantly share code, notes, and snippets.

@rohithpeddi
Last active December 2, 2016 12:42
Show Gist options
  • Save rohithpeddi/76f7d27902f97ba398d57bbf99931f1e to your computer and use it in GitHub Desktop.
Save rohithpeddi/76f7d27902f97ba398d57bbf99931f1e to your computer and use it in GitHub Desktop.
Class to read input faster
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args)
{
FastReader fs=new FastReader();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment