Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created January 10, 2016 17:04
Show Gist options
  • Save Jack-Saleem/a645ce5fff4b22c57f9c to your computer and use it in GitHub Desktop.
Save Jack-Saleem/a645ce5fff4b22c57f9c to your computer and use it in GitHub Desktop.
Codeforces 258A LittleElephantAndBits program in java
import java.util.Scanner;
public class LittleElephantAndBits
{
public static void main(String[] args)
{
Scanner z=new Scanner(System.in);
String y=z.next();
StringBuilder sb=new StringBuilder(y);
if(y.contains("0"))
{
for(int i=0;i<sb.length();i++)
{
if(sb.charAt(i)=='0')
{
sb.deleteCharAt(i);
break;
}
}
System.out.println(sb);
}
else
System.out.println(sb.deleteCharAt(0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment