-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathLONGSEQ.cpp
More file actions
41 lines (36 loc) · 805 Bytes
/
Copy pathLONGSEQ.cpp
File metadata and controls
41 lines (36 loc) · 805 Bytes
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
// https://www.codechef.com/problems/LONGSEQ
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
for (int x = 0; x < t; x++)
{
string number;
cin >> number;
long long int zero_count = 0;
long long int one_count = 0;
long long int length = number.length();
for (long long int i = 0; i < length; i++)
{
if (number[i] == '0')
{
zero_count++;
}
else
{
one_count++;
}
}
if (zero_count == 1 || one_count == 1)
{
cout << "Yes" << endl;
}
else
{
cout << "No" << endl;
}
}
return 0;
}