OJ-Problems-Source/HDOJ/1982_autoAC.cpp
2016-08-19 10:57:19 +08:00

47 lines
735 B
C++

#include<iostream>
#include<sstream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
void process(string s)
{
replace(s.begin(),s.end(),'-',' ');
stringstream m(s);
int t;
while(m>>t)
{
cout<<(char)('A'+t-1);
}
}
void run()
{
string s,t="";
cin>>s;
for(int i=0; i<s.size(); i++)
{
if(s[i]=='#')
{
if(t!="")
{
process(t);
t="";
}
cout<<" ";
}
else
{
t+=s[i];
}
}
process(t);
cout<<endl;
}
int main()
{
int T;
cin>>T;
while(T--) run();
return 0;
}