-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray59.cpp
24 lines (22 loc) · 969 Bytes
/
array59.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <string>
using namespace std;
int main(){
int num;
string str;
cin>>num;
for(int i=0;i<num;i++){
cin>>str;
if(str.size()!=4) cout<<"Failure Input"<<endl;
else{
if(str[0]==str[1] && str[0]!=str[2] && str[0]!=str[3] && str[2]!=str[3]) cout<<"Yes"<<endl;
else if(str[0]==str[2] && str[0]!=str[1] && str[0]!=str[3] && str[1]!=str[3]) cout<<"Yes"<<endl;
else if(str[0]==str[3] && str[0]!=str[1] && str[0]!=str[2] && str[1]!=str[2]) cout<<"Yes"<<endl;
else if(str[1]==str[2] && str[1]!=str[0] && str[1]!=str[3] && str[0]!=str[3]) cout<<"Yes"<<endl;
else if(str[1]==str[3] && str[1]!=str[0] && str[1]!=str[2] && str[0]!=str[2]) cout<<"Yes"<<endl;
else if(str[2]==str[3] && str[2]!=str[0] && str[2]!=str[1] && str[0]!=str[1]) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
return 0;
}