Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Java_Лекция 2 / laba2
.java class laba2
{
public static void main(String[] args) throws java.io.IOException
{
//INPUT
byte[] buf=new byte[256];
System.out.println("Input string (Size<255)");
int n = System.in.read(buf);
String s1 = new String(buf,0,n-1);
//Create new
String s2 = new String(s1);//Cut string
String word = new String();//Output
int poz;
while((poz=s2.indexOf(' '))!=-1)
{
word = s2.substring(0,poz);
s2 = s2.substring(poz+1);
if((word.charAt(0)>='0' && word.charAt(0)<='9')&&(word.charAt(word.length()-1)>='0' && word.charAt(word.length()-1)<='9'))
System.out.println(word);
}
word = s2;
if((word.charAt(0)>='0' && word.charAt(0)<='9')&&(word.charAt(word.length()-2)>='0' && word.charAt(word.length()-2)<='9'))
System.out.println(word);
}
}
Соседние файлы в папке Java_Лекция 2