import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String helper
= "985, 913, 123, SomeotherText, MoreText, MoreText"; Pattern pattern = Pattern.compile("\\b\\d{3}");
Matcher matcher = pattern.matcher(helper);
while (matcher.find()) {
newtext = "Number: " + matcher.group() + "\n"+ newtext;
helper = helper.replaceAll(matcher.group() + ", ","");
}
newtext = newtext + "________________\n"+ helper;
}
}
aW1wb3J0IGphdmEudXRpbC5yZWdleC5NYXRjaGVyOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4LlBhdHRlcm47CmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmcgaGVscGVyID0gIjk4NSwgOTEzLCAxMjMsIFNvbWVvdGhlclRleHQsIE1vcmVUZXh0LCBNb3JlVGV4dCI7CiAgICAgICAgUGF0dGVybiBwYXR0ZXJuID0gUGF0dGVybi5jb21waWxlKCJcXGJcXGR7M30iKTsKICAgICAgICBNYXRjaGVyIG1hdGNoZXIgPSBwYXR0ZXJuLm1hdGNoZXIoaGVscGVyKTsKICAgICAgICBTdHJpbmcgbmV3dGV4dCA9ICIiOwogICAgICAgIAogICAgICAgIHdoaWxlIChtYXRjaGVyLmZpbmQoKSkgewogICAgICAgICAgICBuZXd0ZXh0ID0gIk51bWJlcjogIiArIG1hdGNoZXIuZ3JvdXAoKSArICJcbiIrIG5ld3RleHQ7CiAgICAgICAgICAgIGhlbHBlciA9IGhlbHBlci5yZXBsYWNlQWxsKG1hdGNoZXIuZ3JvdXAoKSArICIsICIsIiIpOwogICAgICAgIH0KICAgICAgICBuZXd0ZXh0ID0gbmV3dGV4dCArICJfX19fX19fX19fX19fX19fXG4iKyBoZWxwZXI7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKG5ld3RleHQpOwoJfQp9