字符串入门题。
判断 的值,然后对于不同情况单独处理即可。
Code:
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
int x = 0, m = 1;
char ch = getchar();
while(!isdigit(ch)){
if(ch == '-') m = -1;
ch = getchar();
}
while(isdigit(ch)){
x = x * 10 + ch - 48;
ch = getchar();
}
return x * m;
}
inline void write(int x){
if(x < 0){
putchar('-');
write(-x);
return;
}
if(x >= 10) write(x / 10);
putchar(x % 10 + '0');
}
signed main(){
int t = read(), q = read();
while(t--){
string s, s1;
cin>>s>>s1;
if(q == 1){
if(s == s1) puts("Yes");
else puts("No");
}
else{
for(int i = 0; i < s.size(); i++){
if(s[i] >= 'A' && s[i] <= 'Z'){
s[i] = s[i] - 65 + 97;
}
if(s1[i] >= 'A' && s1[i] <= 'Z'){
s1[i] = s1[i] - 65 + 97;
}
}
if(s == s1) puts("Yes");
else puts("No");
}
}
}