Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- char str[50000][35], t[50000];
- int main()
- {
- //clrscr();
- //cout << "Enter any five string (name) : ";
- int T;
- cin >> T;
- while (T--)
- {
- int i, j, n;
- cin >> n;
- for (i = 0; i < n; i++)
- {
- cin >> str[i];
- }
- for (i = 1; i < n; i++)
- {
- for (j = 1; j < n; j++)
- {
- if (strcmp(str[j - 1], str[j]) > 0)
- {
- strcpy(t, str[j - 1]);
- strcpy(str[j - 1], str[j]);
- strcpy(str[j], t);
- }
- }
- }
- /*cout << endl;
- for (i = 0; i < n; i++)
- {
- cout << str[i] << "\n";
- }*/
- int q;
- cin >> q;
- getchar();
- while (q--)
- {
- char que[10];
- gets(que);
- for (int z = 0; z < n; z++)
- {
- if (que[0] == str[z][0])
- {
- cout << str[z] << endl;
- str[z][0] = '0';
- break;
- }
- else if (z == n - 1)
- cout << "Already Mastered" << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement