mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
bd4f730b16
1900-1999
47 lines
735 B
C++
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;
|
|
}
|