import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
String m = "";
while((m=br.readLine())!=null){
if(m.trim().equals("")){
sb.append("\n");
continue;
}
int ind=0;
for(int i=0;i<m.length();i++){
if(m.charAt(i)>='0' && m.charAt(i)<='9'){
ind+=m.charAt(i)-48;
if(i<m.length()-1){
if(m.charAt(i+1)>='0' && m.charAt(i+1)<='9'){
continue;
}
}
i++;
if(m.charAt(i)=='b'){
for(int j=0;j<ind;j++){
sb.append(' ');
}
}else{
for(int j=0;j<ind;j++){
sb.append(m.charAt(i));
}
}
ind=0;
}
if(m.charAt(i)=='!'){
sb.append("\n");
}
}
sb.append("\n");
}
System.out.print(sb);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
String m = "";
while((m=br.readLine())!=null){
if(m.trim().equals("")){
sb.append("\n");
continue;
}
int ind=0;
for(int i=0;i<m.length();i++){
if(m.charAt(i)>='0' && m.charAt(i)<='9'){
ind+=m.charAt(i)-48;
if(i<m.length()-1){
if(m.charAt(i+1)>='0' && m.charAt(i+1)<='9'){
continue;
}
}
i++;
if(m.charAt(i)=='b'){
for(int j=0;j<ind;j++){
sb.append(' ');
}
}else{
for(int j=0;j<ind;j++){
sb.append(m.charAt(i));
}
}
ind=0;
}
if(m.charAt(i)=='!'){
sb.append("\n");
}
}
sb.append("\n");
}
System.out.print(sb);
}
}
No comments:
Post a Comment