#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int n;
while(cin>>s)
{
for(int i=0;i<s.length();i++)
{
n=0;
if(s[i]-'0'>=0&&s[i]-'0'<10)
{
n=s[i]-'0';
i++;
while(s[i]-'0'>=0&&s[i]-'0'<10)
{
if(s[i]-'0'>=0&&s[i]-'0'<10) n+=s[i]-'0';
else
{
break;
}
i++;
}
if(s[i]=='b') s[i]=' ';
else if(s[i]=='!') s[i]='\n';
for(int j=0;j<n;j++) cout<<s[i];
}
else if(s[i]=='b') cout<<" ";
else if(s[i]=='!') cout<<"\n";
else cout<<s[i];
}
cout<<endl;
}
}