1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <queue> #include <set> #include <vector> using namespace std;
const int INF = ~0u>>1; typedef pair <int,int> P; #define MID(x,y) ((x+y)>>1) #define iabs(x) ((x)>0?(x):-(x)) #define REP(i,a,b) for(int i=(a);i<(b);i++) #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define pb push_back #define mp make_pair #define print() cout<<"--------"<<endl
char str[20] = "Hello, world!"; int main(){ int t; cin >> t; getchar(); char s1[300],s2[3000]; while (t--){ int cnt = 0; cin.getline(s1,256); int len1 = strlen(s1); bool flag = 1; for (int i = 0; i < len1; i ++){ if (cnt > len1) {flag = 0;break;} if (s1[i] == '_'){ for (int j = 0; j < len1; j ++){ s2[cnt ++] = s1[j]; } } if (s1[i] == '!'){ for (int j = 0; j < strlen(str); j ++){ s2[cnt ++] = str[j]; } } } if (cnt != len1) flag = 0; if (flag){ for (int i = 0; i < len1; i ++){ if (s1[i] != s2[i]) {flag = 0;break;} } } if (!flag){ puts("No"); }else puts("Yes"); } return 0; }
|