import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern;
public class seven_2015 { private static Pattern p = Pattern.compile("\d+"); private static Matcher m; private static Scanner sc;
private static void check(StringBuffer str) {
if(str.charAt(str.length()-1) != '#') {
System.out.println("输入字符串,请以#结尾.");
System.exit(0);
}
}
public static void main(String[] args) {
sc = new Scanner(System.in);
StringBuffer str = new StringBuffer(new String(sc.nextLine()));
check(str); //检查输入的字符串是否合法
m = p.matcher(str);
int maxLen = 0;
int startPosition = -1;
int startTemp = -1;
String target = "";
String temp = "";
while(m.find()){ //找到匹配
temp = m.group(); //拿到匹配字符串
if(temp.length() > maxLen) { //找到当前最大字符串
startPosition = m.start()+1;
target = temp;
maxLen = temp.length();
}
}
if(startPosition != -1) {
System.out.println(target+" " + "起始位置:" + startPosition);
}else {
System.out.println("未找到");
}
m.reset(); //重置m指针
// 可能出现多个数字串是相同长
while(m.find()){ //找到匹配
temp = m.group(); //拿到匹配字符串
startTemp = m.start() + 1;
if(temp.length() == maxLen && startTemp != startPosition) {
System.out.println(temp+" " + "起始位置:" + startTemp);
}
}
sc.close();
}
}