import java.util.*;
import java.lang.*;
class Main
{
{
byte[] input = {77, 83, 65, 80, 79, 67};
int i = input.length;
while (i-- > 0 && input[i] == 32) {}
byte[] output = new byte[i+1];
System.
arraycopy(input,
0, output,
0, i
+1);
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCWJ5dGVbXSBpbnB1dCA9IHs3NywgODMsIDY1LCA4MCwgNzksIDY3fTsKCQlpbnQgaSA9IGlucHV0Lmxlbmd0aDsKCQl3aGlsZSAoaS0tID4gMCAmJiBpbnB1dFtpXSA9PSAzMikge30KCgkJYnl0ZVtdIG91dHB1dCA9IG5ldyBieXRlW2krMV07CgkJU3lzdGVtLmFycmF5Y29weShpbnB1dCwgMCwgb3V0cHV0LCAwLCBpKzEpOwoJCQoJCVN5c3RlbS5vdXQucHJpbnRsbihBcnJheXMudG9TdHJpbmcoaW5wdXQpKTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oQXJyYXlzLnRvU3RyaW5nKG91dHB1dCkpOwoJfQp9
[77, 83, 65, 80, 79, 67]
[77, 83, 65, 80, 79, 67]