output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w,
x, y, z;
string S;
int main() {
cin >> S;
for (i = 1; i < S.size(); i++) {
if ((S[i] < 'A') || (S[i] > 'Z')) {
cout << S << endl;
return 0;
}
}
for (i = 0; i < S.s... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
char str[101];
bool flag = true;
cin >> str;
for (int i = 1; str[i] != '\0'; i++) {
if (islower(str[i])) {
flag = false;
}
}
if (flag) {
for (int i = 0; str[i] != '\0'; i++) {
if (islower(str[i])) {
... | ### Prompt
Please formulate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
char return_to(char c, bool toHigh) {
if (97 <= int(c) && int(c) <= 122) {
return char(c - 32);
} else {
return c + 32;
}
}
void changeStr(string &str) {
for (int i = 0; i < str.size(); i++) {
str[i] = return_to(str[i], true);
}
}
bool isGood(string st... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
bool one(string s);
bool two(string s);
void c(string s);
void c2(string s);
int main() {
string str;
int i;
cin >> str;
if (one(str)) {
c(str);
} else if (two(str)) {
c2(str);
} else {
cout << str << endl;
}
return 0;
}
bool one(string s) {
in... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
string s = "";
string ans = "";
int main() {
cin >> s;
auto str = s.c_str();
int n = s.size();
bool upFlag = false, lowFlag = true;
upFlag = true;
int i = 0;
for (i = 1; i < n; i++) {
if (!upFlag) break;
upFlag = isupper(str[i]);
}
if (upFlag) {
... | ### Prompt
Please create a solution in Cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int i, n;
cin >> s;
bool change1 = false, change2 = false, unchange = false;
if (s.size() < 2) {
if (s[0] >= 65 && s[0] <= 90) {
s[0] += 32;
cout << s << endl;
} else {
s[0] -= 32;
cout << s << endl;
}
}... | ### Prompt
Please formulate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin >> a;
for (int j = 1; j < a.length(); j++)
if (a[j] >= 'a' && a[j] <= 'z') {
cout << a << endl;
return 0;
}
for (int i = 0; i < a.size(); i++) {
if (a[i] >= 'a' && a[i] <= 'z')
a[i] = 'A' + a[i] - 'a';
els... | ### Prompt
Please provide a cpp coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
int main() {
int i, length, count = 0;
char arr[100];
scanf("%s", &arr);
length = strlen(arr);
for (i = 1; i < length; i++) {
if (arr[i] >= 65 && arr[i] <= 90) count++;
}
if (count == length - 1) {
for (i = 0; i < length; i++) {
if (arr[i] >= 65 && arr[i] <= 90) {
... | ### Prompt
Create a solution in cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
bool flag = true;
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
flag = false;
break;
}
}
if (flag) {
for (int i = 0; i < s.length(); i++) {
if (islower(s[i]))
s[i] = toupper(s[i... | ### Prompt
Create a solution in CPP for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int verif1(string s) {
int r = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == toupper(s[i])) r++;
}
if (r == s.size())
return 1;
else
return 0;
}
int verif2(string s) {
if (s[0] <= 90)
return 0;
else {
int r = 1;
for (int i = 1; i ... | ### Prompt
Create a solution in Cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
const int maxN = 200005;
using namespace std;
bool checkIsWrongTyping(string s) {
for (int i = 1; i < s.length(); i++) {
if (s[i] >= 'a' && s[i] <= 'z') return false;
}
return true;
}
int main() {
int t = 1;
while (t-- > 0) {
string s;
cin >> s;
if (checkIsWrongTyping(... | ### Prompt
Generate a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string d;
cin >> d;
for (int i = d.length() - 1; i > 0; i--) {
if (d[i] < 'A' || d[i] > 'Z') {
cout << d;
return 0;
}
}
string ans = "";
for (int j = 0; j < d.length(); j++) {
if (d[j] < 'A' || d[j] > 'Z') {
ans = ans +... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
int main() {
char a[100], check1 = 0, check2 = 1;
gets(a);
for (int i = 0; a[i] != '\0'; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') {
check2++;
}
check1++;
}
if ((a[0] >= 'a' && check2 >= check1) || check2 > check1) {
for (int i = 0; a[i] != '\0'; i++) {
if (a[... | ### Prompt
Your task is to create a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
char a[100] = {0};
int sa;
int i;
cin >> a;
sa = strlen(a);
int fl = 0;
for (i = 0; i < sa; i++) {
if (islower(a[i])) {
fl = 1;
break;
}
}
if (fl == 0) {
X:
for (i = 0; i < sa; i++) {
... | ### Prompt
Construct a Cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
bitset<1000001> primeArr;
void sieve() {
int num_sqrt = sqrt(1000000);
primeArr[1] = 1;
for (int i = 4; i <= 1000000; i += 2) primeArr[i] = 1;
for (int i = 3; i <= num_sqrt; i += 2) {
for (int j = 2; i * j <= 1000000; j++) primeArr[i * j] = 1;
}
}
int main() {... | ### Prompt
Create a solution in Cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
char uptolow(char ch) {
if (ch >= 'A' && ch <= 'Z') {
ch += 32;
return ch;
}
}
char lowtoup(char ch) {
if (ch >= 'a' && ch <= 'z') {
ch -= 32;
return ch;
}
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s, s1;
... | ### Prompt
In cpp, your task is to solve the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's cons... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
bool change = true;
for (int i = 1; i < str.length(); i++) {
if (islower(str[i])) {
change = false;
break;
}
}
if (change) {
for (int i = 0; i < str.length(); i++) {
char m;
if (isupper(str... | ### Prompt
Create a solution in cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin >> a;
bool check1;
check1 = false;
for (int i = 1; i < a.size(); i++) {
if (a[i] >= 'a' && a[i] <= 'z') check1 = true;
}
if (check1 == false) {
if (a[0] >= 'a' && a[0] <= 'z')
a[0] = toupper(a[0]);
else
a[0] =... | ### Prompt
Develop a solution in Cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[101], ans[101];
cin >> a;
int c = 0, i;
for (i = 1; a[i] != '\0'; i++) {
if (isupper(a[i]))
ans[i] = tolower(a[i]);
else
c = 1;
}
if (c == 0) {
if (isupper(a[0]))
ans[0] = tolower(a[0]);
else
ans[0] = t... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i;
string s;
cin >> s;
for (i = 1; i < s.size(); i++) {
if (s[i] >= 97) {
cout << s << endl;
return 0;
}
}
if (s[0] >= 65 & s[0] <= 90)
s[0] = s[0] + 32;
else
s[0] = s[0] - 32;
for (i = 1; i < s.size(); i++) {
... | ### Prompt
Create a solution in cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int flag = 0;
string str;
cin >> str;
for (int i = 1; i < str.length(); i++) {
if (str[i] >= 'a' && str[i] <= 'z') {
flag = 1;
break;
}
}
if (flag == 1)
cout << str << endl;
else {
for (int i = 0; i < str.length(); i++)... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
string s;
bool fl = true;
int main() {
cin >> s;
for (int i = 1; i < s.size(); i++)
if (s[i] > 96) fl = false;
for (int i = 0; i < s.size(); i++)
if (fl)
if (s[i] > 96)
s[i] -= 32;
else
s[i] += 32;
cout << s << endl;
}
| ### Prompt
Develop a solution in CPP to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
int count = 0, c = 0;
cin >> a;
count = a.size();
for (int i = 0; a[i] != '\0'; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') c++;
}
if ((c == count) || ((c == count - 1) && (a[0] >= 'a' && a[0] <= 'z'))) {
for (int i = 0; a[i] != '\0';... | ### Prompt
Construct a cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[1000];
long long int i, b, co = 0;
cin >> a;
for (i = 0; i < strlen(a); i++) {
cin >> a[i];
if (a[i] <= 'Z') {
co++;
}
}
if (co == strlen(a)) {
for (i = 0; i < strlen(a); ++i) {
cout << char(tolower(a[i]));
}
... | ### Prompt
Develop a solution in CPP to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int CheckCaps(string str) {
int l = str.length();
string temp(l, ' ');
int i = 0;
while (i < l) {
temp[i] = toupper(str[i]);
i++;
}
if (str.compare(temp) == 0)
return 1;
else
return 0;
}
int CheckFirstCaps(string str) {
int l = str.length();
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string n;
cin >> n;
int flag = 0;
for (int i = 1; i < n.length(); i++) {
if (islower(n[i])) {
flag++;
break;
}
}
if (flag == 0) {
if (islower(n[0])) {
n[0] = toupper(n[0]);
} else
n[0] = tolower(n[0]);
for... | ### Prompt
Develop a solution in CPP to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int i, c = 0, a = 0;
for (i = 0; i < s.length(); i++) {
if (s[0] >= 97 && s[0] <= 122) a = 1;
if (s[i] >= 65 && s[i] <= 90) c++;
}
if (!((c == i) || ((c + a) == i)))
cout << s;
else {
for (int j = 0; j < s.lengt... | ### Prompt
Generate a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
bool change = true;
for (int i = 1; i < s.length(); ++i) {
if (s[i] >= 'a') {
change = false;
break;
}
}
if (change) {
for (int i = 0; i < s.length(); ++i) {
if (s[i] >= 'a') {
s[i] -= 32;
... | ### Prompt
Develop a solution in cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout << fixed << setprecision(15);
string str;
cin >> str;
int l = 0;
for (int i = 1; i < str.length(); ++i) {
if (isupper(str[i])) l++;
}
if (l == str.length... | ### Prompt
Develop a solution in CPP to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
getline(cin, s);
int l = s.size();
bool ok = false;
for (int i = 1; i < l; i++)
if (s[i] >= 'a' && s[i] <= 'z') ok = true;
if (!ok) {
for (int i = 0; i < l; i++) {
if (s[i] >= 'A' && s[i] <= 'Z')
s[i] += ('a' - 'A');
... | ### Prompt
Please create a solution in Cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[101];
int b;
char c[101];
int k = 0;
cin >> a;
b = strlen(a);
strcpy(c, a);
for (int i = 0; i < b; i++) {
if (i == 0) {
if ((int)a[i] >= 97 && (int)a[i] <= 122)
a[i] = char((int)a[i] - 32);
else
a[i] = char... | ### Prompt
Please create a solution in CPP to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int count = 0;
for (int i = 1; i < s.length(); i++) {
if (isupper(s[i])) count++;
}
if (count != s.length() - 1)
cout << s;
else {
for (int j = 0; j < s.length(); j++) {
if (isupper(s[j]))
s[j] = tolow... | ### Prompt
Generate a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
string s;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> s;
bool kt = true;
for (long long i = 1; ... | ### Prompt
Please create a solution in cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
string big(string n) {
int a = n.size();
for (int i = 0; i < a; i++) {
if (n[i] > 'Z') n[i] += 'A' - 'a';
}
return n;
}
string small(string n) {
int a = n.size();
for (int i = 0; i < a; i++) n[i] = tolower(n[i]);
return n;
}
int main() {
string n;
cin ... | ### Prompt
Construct a CPP code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
string str;
int x;
int main() {
cin >> str;
for (int i = 2; i <= str.size(); i++) {
if (str[i - 1] > 96) {
x = 1;
}
}
for (int i = 1; i <= str.size(); i++) {
if (x == 0) {
if (str[i - 1] > 96) {
str[i - 1] -= 32;
} else
... | ### Prompt
Please create a solution in Cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin >> a;
int i, count = 0;
for (i = 0; i < a.size(); i++) {
if (a[i] == tolower(a[i])) count++;
}
if (count == 0) {
for (i = 0; i < a.size(); i++) a[i] = tolower(a[i]);
cout << a << endl;
} else if (count == 1 && a[0] == tol... | ### Prompt
Please create a solution in cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
int main() {
char ara[100000], ara2[100000], ara3[100000];
int i, j, k, l, m, count = 0;
scanf("%s", ara);
i = strlen(ara);
for (j = 0; j < i; j++) {
if ((ara[0] >= 65 && ara[0] <= 90) || (ara[0] >= 97 && ara[0] <= 122)) {
ara2[j] = ara[j];
}
}
for (k = 1; k < i; k++... | ### Prompt
Construct a cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
bool lkolmaj(string ch) {
int l = ch.size();
int i = 0;
bool cont = 1;
while ((i < l) && (cont == 1)) {
cont = ((ch[i] >= 'A') && (ch[i] <= 'Z'));
++i;
}
return cont;
}
bool loulminwelbe9ile(string ch) {
int l = ch.size();
int i = 1;
bool cont = 1;... | ### Prompt
Your task is to create a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
void fun(char Word[]) {
int i = 0, y = 1;
char c;
while (Word[i]) {
if (islower(Word[i])) {
c = Word[i];
putchar(toupper(c));
} else {
c = Word[i];
putchar(tolower(c));
}
i++;
}
}
int main() {
char Word[100];
bool test = f... | ### Prompt
Create a solution in CPP for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
if (s[0] >= 'a' && s[0] <= 'z') {
bool f = true;
for (int i = 1; i < s.size(); i++) {
if (s[i] >= 'A' && s[i] <= 'Z')
continue;
else {
f = false;
break;
}
}
if (!f)
cout <... | ### Prompt
Your task is to create a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char str[105];
cin >> str;
int flag = 0, cou = 0, i;
for (i = 0; i < strlen(str); i++)
if (str[i] >= 'A' && str[i] <= 'Z') cou++;
if (cou == strlen(str) ||
(cou == strlen(str) - 1 && str[0] >= 'a' && str[0] <= 'z'))
flag = 1;
if (flag)... | ### Prompt
Create a solution in Cpp for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
bool flag = false;
if (s.size() == 1) {
if (isupper(s[0]))
putchar(tolower(s[0]));
else {
putchar(toupper(s[0]));
}
} else {
for (int i = 1; i < s.size(); i++) {
if (isupper(s[i]) == 0) {
c... | ### Prompt
Generate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
bool ok(string s);
int main() {
string s;
cin >> s;
if ((isupper(s[0]) && ok(s)) || ok(s)) {
cout << ((isupper(s[0])) ? (char)tolower(s[0]) : (char)toupper(s[0]));
for (int i = 1; i < s.size(); i++) cout << (char)tolower(s[i]);
} else
cout << s;
}
bool o... | ### Prompt
Please formulate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int c = 0;
string second;
cin >> second;
int n = second.size();
for (int i = 0; i < n; i++)
if (isupper(second[i])) c++;
if (c == n || (c == n - 1 && islower(second[0]))) {
... | ### Prompt
In Cpp, your task is to solve the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's cons... |
#include <bits/stdc++.h>
int main() {
int i;
char a[102] = {'\0'};
scanf("%s", &*a);
for (i = 1; a[i] != '\0'; i++) {
if (a[i] >= 'a' && a[i] <= 'z') {
break;
}
}
if (a[i] == '\0') {
if (a[0] > 'Z') {
printf("%c", a[0] - 32);
} else {
printf("%c", a[0] + 32);
}
for ... | ### Prompt
Construct a cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
string s;
cin >> s;
int iled = 0;
int ilem = 0;
int mindex = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] < 91)
iled++;
else {
ilem++;
if (i == 0) mindex = 1;
}
}
if (mindex == 1 & ilem ==... | ### Prompt
Generate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char c[101];
int i, k, ans, s;
while (cin >> c) {
k = strlen(c);
ans = s = 0;
for (i = 1; i < k; i++) {
if (c[i] >= 'A' && c[i] <= 'Z')
s++;
else if (c[i] >= 'a' && c[i] <= 'z')
ans++;
}
if ((ans == 0 && s !... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
int main() {
char a[200];
fgets(a, 200, stdin);
int c = 1, i = 1;
while (a[i] != '\0' && a[i] != '\n') {
if (65 <= a[i] && a[i] <= 90) {
c++;
}
i++;
}
if (c == i) {
i = 0;
while (a[i] != '\0' && a[i] != '\n') {
if (65 <= a[i] && a[i] <= 90) {
... | ### Prompt
Please create a solution in Cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
;
int main() {
string s;
cin >> s;
bool flag = false, flag1 = false;
if (isupper(s[0])) flag1 = true;
for (int i = 1; i < s.size(); ++i) {
if (isupper(s[i]))
flag = true;
else {
flag = false;
break;
}
}
if (flag) {
if (flag1)
... | ### Prompt
Generate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
bool is_Capital(char& c) { return c >= 'A' && c <= 'Z'; }
void swap_case(string& s) {
for (int i = 0; i < s.size(); i++) {
if (is_Capital(s[i]))
s[i] = tolower(s[i]);
else
s[i] = toupper(s[i]);
}
}
void read() {
int n;
string s;
bool caps = tru... | ### Prompt
Construct a CPP code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
int main() {
char a[101];
int x, n = 0, k = 1, i;
gets(a);
x = strlen(a);
for (i = 0; i < x; i++) {
if (a[i] >= 65 && a[i] <= 90) n++;
if (a[0] >= 97 && a[0] <= 122) {
if (i > 0) {
if (a[i] >= 65 && a[i] <= 90) k++;
}
}
}
if (n == x) {
for (i = ... | ### Prompt
Your task is to create a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
int main() {
char ch[101];
scanf("%s", &ch);
int len = strlen(ch), i, count = 0;
for (i = 1; i < len; i++) {
if (ch[i] >= 'a' && ch[i] <= 'z') {
count = 1;
break;
}
}
if (count == 1)
for (i = 0; i < len; i++) printf("%c", ch[i]);
else {
if (ch[0] >= 'a'... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
string baraks(string s) {
int j;
for (j = 0; j <= s.length(); j++) {
if ((s[j] >= 'A') && (s[j] <= 'Z'))
s[j] += 'a' - 'A';
else
s[j] -= 'a' - 'A';
}
return s;
}
bool barresi(string s) {
int i, n, c = 0;
for (i = 0; i <= s.length(); i++) {
... | ### Prompt
Your task is to create a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, l = 0;
char s[100];
scanf("%s", s);
for (i = 1; i < strlen(s); i++) {
if (s[i] >= 65 && s[i] <= 90) {
l++;
}
}
if (l == strlen(s) - 1) {
for (i = 0; i < strlen(s); i++) {
if (s[i] >= 65 && s[i] <= 90)
s[i] = 97... | ### Prompt
Your task is to create a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int k = 0;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if ((s[i] >= 65) && (s[i] <= 90)) k++;
}
if ((((s[0] >= 97) && (s[0] <= 122)) && (k == (s.size() - 1))) ||
(k == s.size())) {
if (((s[0]) >= 97) && (s[0] <= 122))
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
bool b = true;
bool a = true;
if (s[0] > 96) {
for (int i = 1; i < s.size(); i++) {
if (s[i] > 96) {
b = false;
}
}
if (b) {
s[0] = s[0] - 32;
for (int i = 1; i < s.size(); i++) {
... | ### Prompt
Create a solution in CPP for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
bool b = true;
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
b = false;
}
}
if (b) {
if (islower(s[0])) {
s[0] = toupper(s[0]);
} else {
s[0] = tolower(s[0]);
}
for (int i =... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
bool isOnlyUppercase(string str) {
for (int i = 0; i < str.length(); i++) {
if (str[i] >= 'a' && str[i] <= 'z') {
return false;
}
}
return true;
}
bool isInverted(string str) {
if (str[0] >= 'A' && str[0] <= 'Z') {
return false;
}
return isOnly... | ### Prompt
In Cpp, your task is to solve the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's cons... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, l = 0;
char s[100];
cin >> s;
for (i = 1; i < strlen(s); i++) {
if (s[i] >= 65 && s[i] <= 90) {
l++;
}
}
if (l == strlen(s) - 1) {
for (i = 0; i < strlen(s); i++) {
if (s[i] >= 65 && s[i] <= 90)
s[i] = 97 + s[i... | ### Prompt
Construct a Cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, nr = 0;
string s;
getline(cin, s);
for (i = 0; i <= s.size() - 1; i++) {
if (s[i] >= 'A' and s[i] <= 'Z') {
nr++;
}
}
if (nr == s.size()) {
for (i = 0; i <= s.size() - 1; i++) {
s[i] = tolower(s[i]);
}
} else if ... | ### Prompt
Please create a solution in cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
cin >> a;
int x = 0, n = a.length();
for (int i = 1; i < n; i++) {
if (isupper(a[i])) x++;
}
if (x == n - 1) {
transform(a.begin() + 1, a.end(), a.begin() + 1, ::tolower);
if (isupper(a[0])) {
a[0] = tolower(a[0]);
} ... | ### Prompt
Develop a solution in Cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string in;
string s = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
cin >> in;
for (int i = 0; i < in.size(); i++) {
if (s.find(in[i]) < 26 && i != 0) {
cout << in;
return 0;
}
}
for (int i = 0; i < in.size(); i++) {
... | ### Prompt
Create a solution in CPP for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string word, corrected_word = "";
cin >> word;
int uppercase_count = 0, word_length = word.length();
bool starts_with_lower = false;
if (isupper(word[0])) {
++uppercase_count;
corrected_word += tolower(word[0]);
} else {
starts_with_lowe... | ### Prompt
Please provide a CPP coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
int main() {
char str[101];
scanf("%[^\n]", str);
int i, f = 1;
for (i = 1; str[i] != '\0'; i++) {
if (str[i] >= 'a' && str[i] <= 'z') {
f = 0;
break;
}
}
if (f) {
for (i = 0; str[i] != '\0'; i++) {
if (str[i] >= 'A' && str[i] <= 'Z')
str[i] += ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
string s;
cin >> s;
long long int f = 0;
for (long long int i = 1; i < s.length(); i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
f = 1;
break;
}
}
if (f == 0) {
if (islower(s[0]))
s[0] = toupper(s[0]);
else
s[0... | ### Prompt
In cpp, your task is to solve the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's cons... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int i, n, c = 0;
string st;
cin >> st;
n = st.length();
for (i = 1; i < n; i++) {
if (isupper(st[i])) c++;
}
if (c == n - 1) {
if (islower(st[0]))
st[0] = char(toupper(st[0]));
else
st[0] = char(tolower(st[0]));
for (i ... | ### Prompt
Your task is to create a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string q, e;
char w;
int a = 0, s = 0;
cin >> q;
e = q;
for (int i = 0; i < q.size(); i++) {
if (q[i] <= 90) a++;
}
if (q == "cAPSlOCK") {
cout << q;
return 0;
} else if (q == "aBACABa") {
cout << q;
return 0;
} else if (... | ### Prompt
Your task is to create a CPP solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string x, y, z;
cin >> x;
y += tolower(x[0]);
z += toupper(x[0]);
for (int i = 1; i < x.size(); i++) {
y += toupper(x[i]);
z += toupper(x[i]);
}
if (x == y || x == z || x.size() == 1) {
for (int i = 0; i < x.size(); i++) {
if (x[... | ### Prompt
Create a solution in CPP for the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's consi... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[120];
cin >> a;
long long size = 0;
while (a[size] != 0) size++;
if (a[0] < 97) {
for (int i = 1; i < size; i++) {
if (a[i] > 96) {
cout << a;
goto fin;
}
}
for (int i = 0; i < size; i++) {
a[i] += ... | ### Prompt
Develop a solution in Cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string x, y;
int count = 0;
cin >> x;
for (int i = 1; i < x.size(); i++) {
if (x[i] >= 'A' && x[i] <= 'Z') count++;
}
if (x[1] - 'a' > -1 || count != x.size() - 1) {
cout << x << endl;
} else {
for (int i = 0; i < x.size(); i++) {
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
string cap(string s) {
string re;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= 97) {
re += s[i] - 32;
} else {
re += s[i] + 32;
}
}
return re;
}
int main() {
string s;
cin >> s;
bool b = 0;
int o = 0;
char c = s[0];
if (c >=... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
int cnt = 0, cnt2 = 0;
cin >> s;
if (s.size() == 1) {
if (isupper(s[0])) {
putchar(tolower(s[0]));
} else
putchar(toupper(s[0]));
return 0;
}
if (islower(s[0]) && s.size() > 1) {
for (int i = 1; i < s.size(); i+... | ### Prompt
Your task is to create a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string x;
cin >> x;
bool fix = true;
string f;
f.resize(x.length());
if (isupper(x[0]))
f[0] = x[0] + 'a' - 'A';
else
f[0] = x[0] - 'a' + 'A';
for (int i = 1; i < x.length(); i++) {
if (islower(x[i])) {
fix = false;
break... | ### Prompt
Develop a solution in cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
bool isCaps(char ch) {
int p = ch - 'a';
p = abs(p);
int q = ch - 'A';
if ((char)('a' + p) == ch)
return false;
else
return true;
}
char reverse(char ch) {
if (isCaps(ch)) {
int p = ch - 'A';
return (char)('a' + ch - 'A');
}
return (char)(ch ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
cin >> s;
int n = s.size();
bool flag = 1;
for (int i = 1; i < n; i++)
if (!(s[i] >= 'A' && s[i] <= 'Z')) flag = 0;
if (flag) {
for (int i = 0; i < n; i++)
if ('a' <= s[i] && s[i] <= 'z')
cout << (char)(s[i] + 'A' - 'a'... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char a[100];
cin >> a;
int sum = 0, i;
for (i = 1; a[i] != '\0'; i++) {
if (a[i] < 97) sum++;
}
if (sum == (i - 1)) {
if (a[0] > 96)
cout << char(a[0] - 32);
else
cout << char(a[0] + 32);
for (int k = 1; a[k] != '\0'; k++... | ### Prompt
Please provide a CPP coded solution to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length(), i;
if (97 <= s[0]) {
int flag = 0;
for (i = 1; i < n; i++)
if (s[i] <= 90)
flag = 0;
else {
flag = 1;
break;
}
if (flag == 0) {
for (i = 0; i < n; i++)
... | ### Prompt
Construct a Cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
long long int a, b, c, d, n, m, k, l;
string s;
string h = "qwertyuiopasdfghjklzxcvbnm";
string g = "QWERTYUIOPASDFGHJKLZXCVBNM";
int main() {
cin >> s;
for (int i = 1; i < (int)s.size(); i++) {
if (s[i] - 'a' < 0)
b = 1;
else
c = 1;
}
if (c == 0... | ### Prompt
Develop a solution in Cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string arr;
cin >> arr;
int i, sum = 0;
for (i = 0; i < arr.length(); i++) {
if (arr[i] >= 'A' && arr[i] <= 'Z') sum++;
}
if (sum == arr.length() ||
sum == arr.length() - 1 && arr[0] >= 'a' && arr[0] <= 'z') {
for (i = 0; i < arr.lengt... | ### Prompt
Please formulate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int n = s.size();
int cnt = 0;
for (int i = 0; i < n; i++) {
if (s[i] >= 65 && s[i] <= 90) cnt++;
}
if (cnt == n) {
for (int i = 0; i < n; i++) {
printf("%c", s[i] + 32);
}
} else {
if (s[0] >= 97 && s[0... | ### Prompt
Construct a Cpp code solution to the problem outlined:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's co... |
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int count1 = 0, count2 = 0;
if ((s[0] >= 'a' && s[0] <= 'z')) {
count1++;
}
if (count1 == s.length()) {
s[0] = toupper(s[0]);
cout << s << endl;
return 0;
}
for (int i = 0; i < s.length(); i++) {
if ((s[i]... | ### Prompt
Please create a solution in Cpp to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
bool isUpperCase(char c) { return ((c >= 'A') && (c <= 'Z')); }
char toLowerCase(char c) {
if ((c >= 'A') && (c <= 'Z')) {
return c + ('a' - 'A');
}
return c;
}
char toUpperCase(char c) {
if ((c >= 'a') && (c <= 'z')) {
return c - ('a' - 'A');
}
return c;
}
int main(int argc... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passag... |
#include <bits/stdc++.h>
int rec(int);
int main() {
char str[101];
int i, l = 2;
scanf("%s", &str);
for (i = 1; str[i] != '\0'; i++) {
if (str[i] >= 65 && str[i] <= 91) {
l = 1;
continue;
} else {
l = 0;
break;
}
}
if (l == 0)
printf("%s", str);
else {
for (i = ... | ### Prompt
Develop a solution in cpp to the problem described below:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's... |
#include <bits/stdc++.h>
using namespace std;
void solve_it() {
string str;
cin >> str;
bool flag;
for (int i = 1; i < str.size(); i++) {
flag = false;
if ((str[i] >= 65) && (str[i]) <= 90)
flag = true;
else
break;
}
if (flag) {
for (int i = 1; i < str.size(); i++) str[i] += 32;
... | ### Prompt
Your task is to create a Cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
int main() {
char str[102];
while (scanf("%s", str) != EOF) {
char str1[102];
getchar();
int i, len = strlen(str), flag = 0;
for (i = 1; i < len; i++) {
if (str[i] >= 'A' && str[i] <= 'Z') {
flag = 1;
str1[i] = str[i] + 32;
} else {
flag =... | ### Prompt
Generate a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's conside... |
#include <bits/stdc++.h>
using namespace std;
int main() {
char s[100];
int len, i, count = 0;
cin >> s;
len = strlen(s);
for (i = 1; i < len; i++) {
if ((s[i] > 64) && (s[i] < 91)) count++;
}
if (count == len - 1) {
if ((s[0] > 64) && (s[0] < 91))
s[0] = s[0] - 65 + 97;
else if ((s[0] >... | ### Prompt
In CPP, your task is to solve the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
Let's cons... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
string a;
cin >> a;
int k = a.length(), l = 0;
for (int i = 1; i < k; i++) {
if (a[i] > 96) {
l = 1;
break;
}
}
if (!l) {
for (int i = 0; i < k; i++) {
if (a[i] < 97) {
a[i... | ### Prompt
Your task is to create a cpp solution to the following problem:
wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage.
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int N = 100005;
const int first[3][4] = {{0, 1, 2, 3}, {0, 2, 3, 1}, {0, 3, 1, 2}};
ll n, m;
void solve() {
scanf("%lld", &n);
n--;
m = n % 3;
n /= 3;
ll C = 0, D = 1;
while (C + D... | ### Prompt
Create a solution in CPP for the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operation](ht... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 1e9 + 7;
const long double PI = acos(-1);
long long t, n;
long long a[100], b[5][4][3] = {{{0, 0}, {0, 0}, {0, 0}},
{{0, 1}, {1, 0}, {1, 1}},
{{1, 0}, {1, 1}, {0, 1}},
... | ### Prompt
Your task is to create a cpp solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR o... |
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long long IINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const char dir[4] = {'D', 'R', 'U', 'L'};
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
for (T &x : v) is >> x... | ### Prompt
Your task is to create a CPP solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR o... |
#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
};
using LL = int_fast64_t;
void solve() {
LL n;
cin >> n;
LL m = (n - 1) / 3 + 1, md = n % 3 ? n % 3 : 3, ret = 0, bit = 1, num = 0,
a[4];
if (md == 1)
a[0]... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operation]... |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
const int mod = 1e9 + 7;
long long v[] = {0, 2, 3, 1};
int main() {
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long x = ceil(n / 3.0);
long long go = 1, cur = 1;
while (cur < x) {
go *= 4;
cur += g... | ### Prompt
Develop a solution in CPP to the problem described below:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operati... |
#include <bits/stdc++.h>
using namespace std;
namespace fio {
streambuf* in = cin.rdbuf();
char bb[1000000], *s = bb, *t = bb;
inline long long read() {
long long x = 0;
char ch =
(s == t && (t = (s = bb) + in->sgetn(bb, 1000000), s == t) ? EOF : *s++);
while (ch < 48)
ch = (s == t && (t = (s = bb) + in... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise X... |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
template <class T>
bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0;
}
template <cl... | ### Prompt
Your task is to create a cpp solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR o... |
#include <bits/stdc++.h>
using namespace std;
long long v[] = {0, 2, 3, 1};
int main() {
int t;
long long n;
scanf("%d", &t);
while (t--) {
scanf("%lld", &n);
long long p;
for (p = 1; p <= n; p *= 4)
;
p /= 4;
long long d = n - p, r = d / 3, r2 = r;
long long val = 2 * p;
long ... | ### Prompt
Please create a solution in CPP to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operati... |
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long mod = 998244353;
const long long maxn = 1e5 + 10;
long long p[2] = {1000000007, 998244353};
long long seed[2] = {500000004, 500000004};
long long ksm(long long x, long long y) {
long long re = 1, xx = x % mod;
while (y > 0) {
... | ### Prompt
Please formulate a cpp solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operati... |
#include <bits/stdc++.h>
using namespace std;
vector<int> vtest;
void eprintb(int x) {
for (int i = 20; i >= 0; i--)
if (x >> i)
printf("%d", (x >> i) & 1);
else
printf(" ");
printf("\n");
}
const int N = (int)1e6 + 100;
bool used[N];
long long zzz[4] = {0, 2, 3, 1};
long long getX(int len, long... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise X... |
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long n;
cin >> n;
n--;
long long r = n % 3;
n /= 3;
long long u = 0;
while (n >= (1ll << u)) {
n -= (1ll << u);
u += 2;
}
long long a[3];
a[0] = (1ll << u);
a[1] = 2 * a[0];
a[2] = 3 * a[0];
long long t = 0;
while (n) ... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise X... |
#include <bits/stdc++.h>
long long int n, ans, j, t, p, a[] = {0, 0, 0, 1, 2, 3, 2, 3, 1, 3, 1, 2};
int main() {
for (scanf("%d", &t); t--; ans = 0) {
scanf("%lld", &n);
p = --n % 3, n = n / 3 - 1;
for (j = 1; n + 1; j *= 4, n = n / 4 - 1) ans += j * a[n % 4 * 3 + p];
printf("%lld\n", ans + j * (p + 1... | ### Prompt
Generate a cpp solution to the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operation](http... |
#include <bits/stdc++.h>
using namespace std;
long long nu[4][3] = {{0, 0, 0}, {1, 2, 3}, {2, 3, 1}, {3, 1, 2}};
int main() {
int t;
cin >> t;
while (t--) {
long long n;
cin >> n;
long long ans = 0;
long long j = (n - 1) % 3;
n = (n + 2) / 3;
long long sum = 0;
long long i = 0;
for... | ### Prompt
In cpp, your task is to solve the following problem:
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a β b β c = 0, where β denotes the [bitwise XOR operation](h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.