Skip to content

Commit c2c4b25

Browse files
committed
Added 1729B - Decode String.cpp
1 parent 92de045 commit c2c4b25

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

1729B - Decode String.cpp

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
ios_base::sync_with_stdio(0);
12+
cin.tie(0);
13+
14+
int t;
15+
cin>>t;
16+
while(t--)
17+
{
18+
int n;
19+
cin>>n;
20+
string s;
21+
cin>>s;
22+
string ans;
23+
for(int i=0; i<n;)
24+
{
25+
if(s[i+2] == '0' && s[i+3] != '0')
26+
{
27+
ans += 96+stoi(s.substr(i,2));
28+
i += 3;
29+
}
30+
else
31+
{
32+
ans += 96+(s[i]-'0');
33+
i++;
34+
}
35+
}
36+
cout<<ans<<endl;
37+
}
38+
return 0;
39+
}

0 commit comments

Comments
 (0)