Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- #include <set>
- #include <algorithm>
- #include <vector>
- #include <stdio.h>
- #include <cmath>
- #include <math.h>
- #include <queue>
- #include <stack>
- #include <climits>
- #include <deque>
- #include <ctime>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef unsigned int ui;
- string H[10];
- void write(string h)
- {
- int u = h.size();
- for (int i = 0; i < h.size(); i++)
- {
- if (i + 1 == h.size())
- cout << "<" << H[h[i] - '0'] << ">@<" << H[u] << "oibt>";
- else
- cout << "<" << H[h[i] - '0'] << ">@<" << H[u] << "oibt> ";
- u--;
- }
- }
- int main()
- {
- for (int i = 0; i <= 9; i++)
- {
- cin >> H[i];
- }
- string s;
- getline(cin, s);
- getline(cin, s);
- char last = ' ';
- ll start = -1;
- for (int i = 0; i < s.size(); i++)
- {
- if (s[i] >= '0'&&s[i] <= '9')
- {
- if (last < '0' || last>'9')
- start = i;
- }
- else
- if (start != 0)
- {
- if (last >= '0'&&last <= '9' && (s[i]<'a' || s[i]>'z') && (s[i]<'A' || s[i]>'Z') && (s[start - 1]<'a' || s[start - 1]>'z') && (s[start - 1]<'A' || s[start - 1]>'Z'))
- {
- string dig = s.substr(start, i - start);
- if (dig.size() <= 9)
- {
- write(dig);
- cout << s[i];
- }
- else
- cout << dig << s[i];
- }
- else
- if (last >= '0'&&last <= '9')
- {
- string dig = s.substr(start, i - start);
- cout << dig << s[i];
- }
- else
- cout << s[i];
- }
- else
- {
- if (last >= '0'&&last <= '9' && (s[i]<'a' || s[i]>'z') && (s[i]<'A' || s[i]>'Z'))
- {
- string dig = s.substr(start, i - start);
- if (dig.size() <= 9)
- {
- write(dig);
- cout << s[i];
- }
- else
- cout << dig << s[i];
- }
- else
- if (last >= '0'&&last <= '9')
- {
- string dig = s.substr(start, i - start);
- cout << dig << s[i];
- }
- else
- cout << s[i];
- }
- last = s[i];
- }
- if (start != 0)
- {
- if ((last >= '0'&&last <= '9') && (s[start - 1]<'a' || s[start - 1]>'z') && (s[start - 1]<'A' || s[start - 1]>'Z'))
- {
- string dig = s.substr(start, s.size() - start);
- if (dig.size() <= 9)
- {
- write(dig);
- }
- else
- cout << dig;
- }
- else
- if (last >= '0'&&last <= '9')
- {
- string dig = s.substr(start, s.size() - start);
- cout << dig;
- }
- }
- else
- if (last >= '0'&&last <= '9')
- {
- string dig = s.substr(start, s.size() - start);
- if (dig.size() <= 9)
- {
- write(dig);
- }
- else
- cout << dig;
- }
- else
- if (last >= '0'&&last <= '9')
- {
- string dig = s.substr(start, s.size() - start);
- cout << dig;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement