/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
int index = builder.indexOf(from);
while (index != -1)
{
builder.replace(index, index + from.length(), to);
index += to.length();
index = builder.indexOf(from, index);
}
}
{
replaceAll(sb, "Bar", "Laa");
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIHJlcGxhY2VBbGwoU3RyaW5nQnVmZmVyIGJ1aWxkZXIsIFN0cmluZyBmcm9tLCBTdHJpbmcgdG8pCnsKICAgIGludCBpbmRleCA9IGJ1aWxkZXIuaW5kZXhPZihmcm9tKTsKICAgIHdoaWxlIChpbmRleCAhPSAtMSkKICAgIHsKICAgICAgICBidWlsZGVyLnJlcGxhY2UoaW5kZXgsIGluZGV4ICsgZnJvbS5sZW5ndGgoKSwgdG8pOwogICAgICAgIGluZGV4ICs9IHRvLmxlbmd0aCgpOwogICAgICAgIGluZGV4ID0gYnVpbGRlci5pbmRleE9mKGZyb20sIGluZGV4KTsKICAgIH0KfQoJCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmdCdWZmZXIgc2IgPSBuZXcgU3RyaW5nQnVmZmVyKCJGb28gQmFyIEJheiBQb28iKTsKCQlyZXBsYWNlQWxsKHNiLCAiQmFyIiwgIkxhYSIpOwoJCVN5c3RlbS5vdXQucHJpbnRsbihzYik7Cgl9Cn0=