Start: Jul, 03, 2019 08:38:00
2019年度暑期短学期第七天 助教场
End: Jul, 04, 2019 23:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 3ms
Memory: 1856kB
Author: 2018212212030
In contest: 1292

#include <iostream>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <list>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
int i, j, k;
int m, n, p;
char a[100010];
int main() {
	scanf("%d", &n);
	getchar();
	while (n--) {
		gets(a);
		int flag = 0;
		for (i = 0; i < strlen(a); i++) {
			if (a[i] == 'p' && a[i + 1] == 'r' &&a[i + 2] == 'i' && a[i + 3] == 'n' &&a[i + 4] == 't'&&a[i + 5] == ' ') {
				a[i + 5] = '(';
				flag = 1;
				break;
			}
		}
		if (flag == 1) {
			int s = strlen(a);
			a[s] = ')';
			a[s + 1] = '\0';
		}
		puts(a);
	}
	return 0;
}