Помогите, пожалуйста, разобраться в чем проблема? Код работает. Вроде как, все требования выполняются. Тестировал на различных строках.
Заранее спасибо
package com.javarush.task.task22.task2203;
/*
Между табуляциями
*/
public class Solution {
public static String getPartOfString(String string) throws TooShortStringException{
if (string == null) throw new TooShortStringException();
int tabQty = string.replaceAll("[^\t]", "").length(); //all thats NOT /t replace to ""
if (tabQty < 3) throw new TooShortStringException();
int firstTab = string.indexOf('\t');
int secondTab = string.indexOf('\t', firstTab + 1);
return string.substring(firstTab + 1, secondTab);
}
public static class TooShortStringException extends Exception {
}
public static void main(String[] args) throws TooShortStringException {
System.out.println(getPartOfString("\tJavaRush - лучший сервис \tобучения Java\t."));
}
}