output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c, d = 0;
char s[105];
cin >> s;
a = strlen(s);
for (b = 1; b < a; b++) {
if (s[b] >= 65 && s[b] <= 90) {
d++;
}
}
if (d == a - 1) {
for (b = 0; b < a; b++) {
if (s[b] >= 65 && s[b] <= 90) {
s[b] += (97 - ... | ### 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() {
bool b = 1;
string s;
cin >> s;
for (int i = 1; i < s.size(); i++)
if (s[i] >= 'a') b = 0;
if (b) {
for (int i = 0; i < s.size(); i++)
if (s[i] >= 'a')
s[i] -= 32;
else if (s[i] <= 'a')
s[i] += 32;
}
cout << 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() {
char str[205];
while (cin >> str) {
int len = strlen(str);
int cnt = 0;
for (int i = 0; i < len; i++)
if (isupper(str[i])) cnt++;
if (cnt == len || (islower(str[0]) && cnt == len - 1)) {
for (int i = 0; i < len; i++) {
if... | ### 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>
int main() {
char str[101];
int i, count = 0, sum = 0;
gets(str);
int len = strlen(str);
if (len == 1) {
if (str[0] >= 97 && str[0] <= 122)
str[0] = str[0] - 32;
else if (str[0] >= 65 && str[0] <= 90)
str[0] = str[0] + 32;
}
if (str[0] >= 97 && str[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() {
int count = 0;
string str;
cin >> str;
int n = str.length() - 1;
for (int i = 1; i < str.length(); i++) {
if (str[i] >= 'A' && str[i] <= 'Z') count++;
}
if (count == n) {
if (str[0] >= 'a' && str[0] <= 'z')
str[0] = str[0] + ('A' - '... | ### 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 checkAccident(string word) {
bool allCaps = true;
for (int i = 1; i < word.length(); i++) {
if (word[i] >= 'A' && word[i] <= 'Z') {
} else {
allCaps = false;
break;
}
}
if (allCaps)
return true;
else
return false;
}
int main() ... | ### 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 len, a, b, c;
string s;
cin >> s;
len = s.length();
if ((len == 1) && (((int)s[0] >= 97) && ((int)s[0] <= 122)))
printf("%c\n", (char)((int)s[0] - 32));
if ((len == 1) && (((int)s[0] >= 65) && ((int)s[0] <= 90)))
printf("%c\n", (char)((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 s;
cin >> s;
int penuh = 1;
for (int i = 0; i < s.length(); i++) {
if (i == 0) {
} else {
if (s[i] >= 'A' && s[i] <= 'Z') {
} else
penuh = 0;
}
}
if (penuh == 1) {
for (int i = 0; i < s.length(); 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;
template <typename _Tp>
inline _Tp read(_Tp& x) {
char c11 = getchar(), ob = 0;
x = 0;
while (c11 ^ '-' && !isdigit(c11)) c11 = getchar();
if (c11 == '-') c11 = getchar(), ob = 1;
while (isdigit(c11)) x = x * 10 + c11 - '0', c11 = getchar();
if (ob) x = -x;
re... | ### 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;
const int mod = 1e9 + 7;
const long long int INF = 1e17;
long long int power(long long int x, long long int y) {
long long int t = 1;
while (y > 0) {
if (y % 2)
y -= 1, t = t * x % mod;
else
y /= 2, x = x * x % mod;
}
return t;
}
long long int 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;
int main() {
string s;
cin >> s;
int c = 0;
for (int i = 0; i < s.size(); i++) {
if (int(s[i]) <= int('Z')) {
c++;
}
}
if (c == s.size()) {
for (int i = 0; i < s.size(); i++) {
s[i] = tolower(s[i]);
}
cout << s;
} else if ((int(... | ### 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;
int main() {
cin >> s;
bool ok = true;
for (int i = 1; i < s.length(); ++i) {
if (!isupper(s[i])) {
ok = false;
break;
}
}
if (ok) {
if (islower(s[0]))
s[0] = toupper(s[0]);
else
s[0] = tolower(s[0]);
for (int ... | ### 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 cnt = 0;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] < 97) cnt++;
}
if (cnt == s.size() || s[0] >= 97 && cnt == s.size() - 1) {
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 97)
cout << char(toupper... | ### 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;
while (cin >> s) {
bool flag = true;
for (int i = 1; i < s.size(); i++) {
if (!(s[i] >= 65 && s[i] <= 90)) {
flag = false;
break;
}
}
if (flag) {
if (s[0] >= 97 && s[0] <= 122) {
s[0] = tou... | ### 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 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)
printf("%s", ch);
else {
if (ch[0] >= 'a' && ch[0... | ### 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 a, b, d, c, i;
string ug;
cin >> ug;
for (i = 1; i < ug.size(); i++) {
if (ug[i] >= 'a') {
cout << ug;
return 0;
}
}
for (char &n : ug) {
if (n >= 'a')
n = n - 32;
else
n = n + 32;
}
cout << ug;
}
| ### 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 word[105];
scanf("%s", word);
bool flag = true;
for (int i = 1; i < strlen(word); ++i) {
if (islower(word[i])) {
flag = false;
break;
}
}
if (!flag) {
printf("%s", word);
} else {
if (isupper(word[0]))
word[0... | ### 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() {
bool temp = false;
string str;
cin >> str;
for (int i = 0; str[i] != '\0'; ++i)
if (str[i] >= 'a' && str[i] <= 'z' && i) {
temp = true;
break;
}
if (temp)
cout << str;
else {
for (int i = 0; str[i]; ++i)
if (str[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 revCaps(string str) {
for (int i = 0; i < str.size(); i++)
if (str[i] >= 'a' && str[i] <= 'z')
str[i] = str[i] + 'A' - 'a';
else if (str[i] >= 'A' && str[i] <= 'Z')
str[i] = str[i] + 'a' - 'A';
return str;
}
int main() {
string str;
cin >>... | ### 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 ::std::cin;
using ::std::cout;
using ::std::string;
bool malaLiterka(string s) {
return s.length() == 1 && s[0] >= 'a' && s[0] <= 'z';
}
bool duzeLiterki(string s) {
for (int i = 0; i < s.length(); ++i) {
if (s[i] >= 'a' && s[i] <= 'z') return false;
}
return true;
}
bool mala... | ### 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 flag = 0;
int count = 0;
if (isupper(s[0])) {
flag = 1;
count = 1;
}
for (int i = 1; i < s.length(); i++) {
if (isupper(s[i])) count++;
}
if (count == s.length()) {
for (int i = 0; i < s.length(); i++) {... | ### 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 f = false;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= 'a') {
f = true;
break;
}
}
if (!f) {
for (int i = 0; i < s.length(); i++) cout << char(s[i] + 32);
cout << endl;
return 0;
}
... | ### 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() {
int i;
int j, flag = 1;
char Str[100];
scanf("%s", Str);
for (i = 1; Str[i] != '\0'; i++) {
if (Str[i] >= 97 && Str[i] <= 122) {
flag = 0;
break;
}
}
if (flag == 1) {
if (Str[0] >= 65 && Str[0] <= 90)
Str[0] = Str[0] + 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;
bool all(string s) {
for (int i = 0; i < (s.length()); i++) {
if (s[i] != toupper(s[i])) return false;
}
return true;
}
int main() {
string s;
cin >> s;
if (s[0] == tolower(s[0]) && all(s.substr(1))) {
s[0] = toupper(s[0]);
for (int i = 1; i < s.leng... | ### 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, p, x, a, b, m;
int i, f = 0;
while (cin >> s) {
if (s.length() == 1 && s[0] <= 'z' && s[0] >= 'a') {
cout << (char)(s[0] - 'a' + 'A') << '\n';
continue;
}
m = s;
p = s[0];
x = tolower(s[0]);
if (x == p) {
... | ### 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 in;
cin >> in;
if (in.size() == 1)
if (islower(in[0]))
printf("%c", toupper(in[0]));
else
printf("%c", tolower(in[0]));
else {
bool all_caps = true;
for (int i = 1; in[i] != '\0'; i++) {
if (islower(in[i])) all_c... | ### 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() {
char st[100];
int v = 0;
for (int i = 0; i < 100; i++) {
st[i] = 0;
}
cin >> st;
int c = 0;
while (st[c] != 0) {
c++;
}
for (int i = 0; i < c; i++) {
if (isupper(st[i])) {
v++;
}
}
if (v == c - 1 && islower(st[0])) {
... | ### 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 a[100];
int i, j, count, k;
count = 0;
scanf("%s", a);
k = 0;
for (j = 0; a[j] != '\0'; j++) {
if (!((int)a[j] < 97) && !((int)a[j] > 122)) {
count++;
k = j;
}
if (count > 1) {
printf("%s", a);
return 0;
}
}
if (k == 0) {... | ### 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 len = (int)s.size();
int l = 0, u = 0;
for (int i = 0; i < len; i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
l++;
} else {
u++;
}
}
if ((s[0] >= 'a' && s[0] <= 'z') && (u == len - 1)) {
cout << (char... | ### 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>
int main() {
char str[1000];
int i, flag = 0, a;
gets(str);
a = strlen(str);
for (i = 1; i < a; i++) {
if (str[i] >= 'A' && str[i] <= 'Z')
continue;
else
flag++;
}
if (flag >= 1) {
printf("%s", str);
} else if (flag == 0 && str[0] >= 'A' && str[0] <= 'Z')... | ### 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 chipi;
cin >> chipi;
if (chipi[0] >= 'a') {
bool r = true;
for (int i = 1; i < chipi.size(); i++)
if (chipi[i] >= 'a') r = false;
if (r) {
chipi[0] -= 32;
for (int i = 1; i < chipi.size(); i++)
if (chipi[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;
bool check(string str) {
int cnt = 0;
for (int i = 0; i < str.length(); i++) {
if (isupper(str[i])) {
cnt++;
}
}
if (islower(str[0]) && cnt == (str.length() - 1))
return 1;
else
return 0;
}
int main() {
string str;
cin >> str;
int cnt =... | ### 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 NOD(int x, int y) {
if (x == 0) return y;
if (y == 0) return x;
while ((x % y != 0) && (y % x != 0)) {
if (x > y)
x %= y;
else
y %= x;
}
if (x < y)
return x;
else
return y;
}
int NOK(int x, int y) { return (x / NOD(x, y)) * y; }
v... | ### 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 check(string s) {
for (int i = s.size() - 1; i > 0; i--)
if (!((0 <= s[i] - 'A') && (s[i] - 'A' <= 26))) return false;
return true;
}
int main() {
string s;
char u, l;
cin >> s;
if (check(s)) {
for (int i = 0; i < s.size(); i++) {
u = toupper(... | ### 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[100];
int len, sign1, sign2, i;
gets(a);
len = strlen(a);
sign1 = 0;
sign2 = 0;
if (a[0] < 'A' || a[0] > 'Z') sign1++;
for (i = 0; i < len; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') sign2++;
}
if (sign2 == len || sign2 == len - 1 && sign1 == 1) {
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() {
int cnt = 0;
string s;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] == tolower(s[i])) cnt++;
}
if (cnt == 0) {
for (int i = 0; i < s.length(); i++) s[i] = tolower(s[i]);
cout << s << endl;
} else if (cnt == 1 && s[0] == to... | ### 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[100];
int l = 0;
scanf("%s", a);
for (int i = 1; i < strlen(a); i++) {
if (a[i] >= 65 && a[i] <= 90) {
l++;
}
}
if (l == strlen(a) - 1) {
for (int i = 0; i < strlen(a); i++) {
if (a[i] >= 65 && a[i] <= 90) {
a[i] = 97 + a[i] - 65;
... | ### 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;
char swichCase(char c) {
if ('a' <= c && c <= 'z') {
c += 'A' - 'a';
} else {
c += 'a' - 'A';
}
return c;
}
string solve(string s) {
bool caps = true;
for (int i = 1; i < s.size(); ++i) {
if ('a' <= s[i] && s[i] <= 'z') {
caps = false;
}
... | ### 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;
char s[102];
int main() {
int i = 0, k = 0, j;
cin >> s;
while (s[i] != '\0') {
if (s[i] >= 'a' && s[i] <= 'z' && i != 0) k++;
i++;
}
if (k == 0 && i != 1) {
for (j = 0; j < i; j++)
if (s[j] >= 'a' && s[j] <= 'z')
s[j] = s[j] + '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>
bool check(char *s) {
++s;
while (*s != '\0') {
if (*s >= 'a') return false;
++s;
}
return true;
}
void solve(char *s) {
if (check(s)) {
if (*s >= 'a') {
*s -= 32;
++s;
}
while (*s != '\0') {
if (*s <= 'Z') *s += 32;
++s;
}
}
}
int mai... | ### 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 w;
cin >> w;
bool ch = 1;
for (int i = 1; i < w.size(); i++) {
if (w[i] > 92 && ch) {
ch = !ch;
break;
}
}
if (ch) {
for (int i = 0; i < w.size(); i++) {
if (w[i] > 92)
w[i] = (char)(w[i] - 32);
els... | ### 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(int argc, char const *argv[]) {
string str;
cin >> str;
int length = str.length();
int count = 0;
for (int i = 1; i < length; i++) {
if (isupper(str[i])) {
count++;
}
}
if (length == count + 1) {
if (isupper(str[0])) {
str[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;
if (s.length() > 1) {
if (s[0] == toupper(s[0]) && s[1] == tolower(s[1])) {
cout << s;
return 0;
} else if (s[0] == tolower(s[0]) && s[1] == tolower(s[1])) {
cout << s;
return 0;
} else {
for (... | ### 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() {
long long n, i, j, k, l, a, b, c, d, f1, f2;
string s1, s2, s3;
cin >> s1;
f1 = 1;
for (i = 1; i < s1.size(); i++) {
if (s1[i] >= 65 && s1[i] <= 90) {
f1 = 1;
} else {
f1 = 0;
break;
}
}
if (f1 == 0) {
cout << s1 ... | ### 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 change(string s) {
for (int i = 0; i < s.size(); i++) {
if (s[i] <= 'Z' && s[i] >= 'A') {
s[i] = s[i] - 'A' + 'a';
} else if (s[i] <= 'z' && s[i] >= 'a') {
s[i] = s[i] - 'a' + 'A';
}
}
cout << s << endl;
}
int main() {
string s;
cin >>... | ### 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() {
char c[101];
int i, len;
bool vis;
while (cin >> c) {
len = strlen(c);
for (i = 1, vis = true; i < len; i++)
if (c[i] >= 97) vis = false;
if (vis) {
if (c[0] >= 97)
cout << char(c[0] - 32);
else
cout << 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 flag = 0;
for (int i = 1; i < s.length(); i++) {
if (!isupper(s[i])) {
flag = 1;
break;
}
}
if (flag == 1) {
cout << s;
} else {
if (islower(s[0])) {
s[0] = toupper(s[0]);
} else if (is... | ### 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;
bool upr(string s) {
for (int k = 1; k < s.length(); k++) {
if (s[k] == toupper(s[k]))
continue;
else
return false;
}
return true;
}
int main() {
string m;
while (cin >> m) {
if ((m[0] == tolower(m[0]) && upr(m))) {
putchar(toupper(m[... | ### 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>
int main() {
std::string input;
std::cin >> input;
bool is_all_upper = true;
bool later_upper = true;
for (int i = 0; i < input.size(); i++) {
if (i > 0 && later_upper) {
later_upper = later_upper && isupper(input[i]);
}
is_all_upper = is_all_upper && isupper(input[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>
int main() {
int i, a, b, c;
int p = 1;
char m[100];
scanf("%s", &m);
for (i = 1; i < strlen(m); i++) {
if (m[i] >= 'a') {
p = 0;
break;
}
}
if (p) {
for (i = 0; i < strlen(m); i++) {
if (m[i] >= 'a') {
m[i] = m[i] - ('a' - 'A');
} else ... | ### 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 s;
cin >> s;
int f = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'A' && s[i] <= 'Z') {
f = 0;
} else {
if (i == 0) {
continue;
}
f = 1;
break;
}
}
if (f == 0) {
if (s[0] >= 'a' && ... | ### 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() {
int i;
char a[101];
cin.getline(a, 101);
for (i = 1; isupper(a[i]); i++) {
}
if (!a[i]) {
for (i = 0; a[i]; i++) {
if (isupper(a[i])) {
a[i] = tolower(a[i]);
} else {
a[i] = toupper(a[i]);
}
}
}
cout << ... | ### 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();
if (s[1] == '\0') {
if (s[0] >= 'a' && s[0] <= 'z') {
s[0] = s[0] - 32;
} else if (s[0] >= 'A' && s[0] <= 'Z') {
s[0] = s[0] + 32;
}
} else {
if (s[0] >= 'a' && s[0] <= 'z') {
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 change(string &s) {
for (int i = 0; i < s.length(); i++) {
s[i] = (s[i] < 97) ? tolower(s[i]) : toupper(s[i]);
}
}
int main() {
string s;
cin >> s;
int len = s.length(), capCount = 0;
bool Caps = false;
for (int i = 0; i < len; i++) capCount += ((int)... | ### 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;
string s;
int main() {
cin >> s;
if (islower(s[0])) {
for (int i = 1; i < s.size(); i++) {
if (islower(s[i])) {
cout << s;
return 0;
}
}
s[0] = toupper(s[0]);
cout << s[0];
for (int i = 1; i < s.size(); i++) {
if (is... | ### 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 str;
getline(cin, str);
int l = str.size();
int cnt = 0;
for (int i = 0; i < l; i++) {
if (str[i] >= 'A' && str[i] <= 'Z') {
cnt++;
}
}
if (cnt == l || (cnt == l - 1 && (str[0] >= 'a' && str[0] <= 'z'))) {
if (str[0] >= 'a... | ### 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 count = 0;
int len = s.size();
bool small = false;
for (int i = 0; i < len; i++) {
if (s[i] < 'a') {
count++;
}
if (s[0] >= 'a') {
small = true;
}
}
if (count == len || (count == len - 1 && sma... | ### 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 mayus = 0;
string palabra;
cin >> palabra;
int n = palabra.size();
for (int i = 0; i < n; i++) {
if ((int)palabra[i] >= 65 && (int)palabra[i] <= 90) {
mayus++;
}
}
if (mayus == n) {
for (int i = 0; i < n; i++) {
palabra... | ### 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 upper(string s) {
for (int i = 0; s[i] != '\0'; i++) {
if (isupper(s[i]) == 0) return 0;
}
return 1;
}
int func(string s) {
if (islower(s[0]) == 0)
return 0;
else {
for (int i = 1; s[i] != '\0'; i++) {
if (isupper(s[i]) == 0) return 0;
}
... | ### 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 sum = 0;
for (int i = 0; i < s.size(); i++)
if ((int)(s[i]) <= 122 && (int)(s[i]) >= 97) sum++;
if (sum > 1 || sum == 1 && (int)(s[0]) <= 90 && 65 <= (int)(s[0]))
cout << s << endl;
else {
for (int i = 0; i < s.si... | ### 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() {
char s[101];
cin >> s;
int i, capital = 0, small = 0, len = strlen(s);
if (len == 1) {
if (s[0] >= 'A' && s[0] <= 'Z')
s[0] = s[0] + 32;
else if (s[0] >= 'a' && s[0] <= 'z')
s[0] = s[0] - 32;
cout << s << endl;
} else {
if ... | ### 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 a[100];
int main() {
int i, l, c = 0;
scanf("%s", a);
l = strlen(a);
for (i = 1; i < l; i++) {
if (a[i] <= 'Z') {
c++;
}
}
int t = 0;
if (a[1] <= 'Z' && c >= l - 1) t++;
if (t != 0) {
for (i = 0; i < l; i++) {
if (a[i] >= 'a') {
... | ### 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 (size_t i = 1; i < s.length(); ++i) {
if (s[i] >= 'a') {
change = false;
break;
}
}
if (change) {
for (size_t i = 0; i < s.length(); ++i) {
if (s[i] >= 'a') {
s[i] -= ... | ### 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() {
int i;
string a;
cin >> a;
for (i = 1; i < a.size(); i++)
if (a[i] >= 'a' && a[i] <= 'z') {
cout << a << endl;
return 0;
}
if (a[0] >= 'a' && a[0] <= 'z')
a[0] -= 32;
else
a[0] += 32;
for (i = 1; i < a.size(); i++) a[i]... | ### 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;
if (find_if(s.begin() + 1, s.end(), ::islower) == s.end()) {
transform(s.begin() + 1, s.end(), s.begin() + 1, ::tolower);
s[0] = islower(s[0]) ? toupper(s[0]) : tolower(s[0]);
}
cout << s << endl;
}
| ### 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() {
int k, i, f = 0;
char a[1000];
cin >> a;
k = strlen(a);
for (i = 1; i < k; i++) {
if (a[i] < 91 && a[i] > 64)
continue;
else {
f = 1;
break;
}
}
if (f == 1) cout << a;
if (f == 0) {
for (i = 1; i < k; i++) a[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>
using namespace std;
int main() {
string s;
int n;
bool flag1 = false, flag2 = false;
cin >> s;
n = s.size();
if (n == 1) {
if (s[0] >= 97) {
cout << char(toupper(s[0])) << "\n";
return 0;
} else {
cout << char(tolower(s[0])) << "\n";
return 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>
int main() {
char s[101];
int n, i, l = 0, m = 0;
scanf("%s", s);
n = strlen(s);
if (s[i] < 97) {
m = 1;
}
for (i = 1; i < n; i++) {
if (s[i] < 97) {
++l;
}
}
if ((m + l) == n) {
for (i = 0; i < n; i++) {
if (s[i] >= 97) {
s[i] = s[i] - 32;
... | ### 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;
template <class T>
inline T gcd(T a, T b) {
return b == 0 ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
return (a / gcd(a, b)) * b;
}
int main() {
string s;
while (cin >> s) {
int len = s.size();
int up = 0;
for (int i = 0; i < len; ... | ### 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, t;
cin >> s;
int e = s.size();
int c = 0;
int m = 1;
int n = (int)s[0];
if (n < 123 && n > 96) {
while (m < e) {
int k = (int)s[m];
if (k < 91 && k > 64) {
c = 1;
} else {
c = 0;
break;
... | ### 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() {
bool flag, flag1 = true;
string str;
cin >> str;
for (int i = 0; i < str.size(); ++i) {
if (i != 0 || isupper(str[i]) && flag1) flag = 1;
if (i != 0 && islower(str[i])) flag1 = 0;
}
if (flag1 && flag) {
for (int i = 0; i < str.size(); ++... | ### 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;
const int maxn = 1e5 * 3;
int main() {
string s;
cin >> s;
int sum = 0;
for (auto it : s)
if (isupper(it)) sum++;
if (s.size() == sum || (islower(s[0]) && sum + 1 == s.size())) {
for (auto& it : s) {
if (islower(it))
it = toupper(it);
e... | ### 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 s[100], c = 0;
cin >> s;
for (int i = 0; i < strlen(s); i++) {
if (s[i] >= 'a' && s[i] <= 'z') c++;
}
if (strlen(s) == 1) {
if (s[0] >= 'a' && s[0] <= 'z')
s[0] = s[0] - 32;
else
s[0] = s[0] + 32;
}
if (c == 1) {
i... | ### 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>
const int maxn = (int)1e6;
const int mod = (int)1e9 + 7;
using namespace std;
string s, cpy;
string fix(string s) {
bool ok = true;
for (int i = 1; i < s.length(); i++) {
if (s[i] > 96) ok = false;
}
for (int i = 0; i < s.length(); i++) {
if (ok) {
if (s[i] > 96)
s... | ### 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 s[100];
cin >> s;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
int l = strlen(s), i = 0, j, k, ctr = 0;
for (i = 0; i < l; i++) {
if (s[i] >= 'A' && s[i] <= 'Z') ctr++;
}
if (ctr == l) {
for (i = 0; i < l; i++) {
s[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;
int main() {
string s;
cin >> s;
int n = s.length();
bool flag = true;
for (int i = 1; i < n; i++) {
if (islower(s[i])) {
flag = false;
}
}
if (flag == true) {
for (int j = 0; j < n; j++) {
if (islower(s[j])) {
s[j] = toupper(s[... | ### 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 word, up = "";
bool cond = true;
cin >> word;
for (int i = 0, l = word.length(); i < l; i++) {
if (i == 0) {
if (isupper(word[i]))
up += tolower(word[i]);
else
up += toupper(word[i]);
} else {
if (isupper... | ### 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>
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 + s[i] - 65;
e... | ### 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 s;
cin >> s;
int small = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 97 && s[i] <= 122) small++;
}
if (small == 0 || (small == 1 && s[0] >= 97 && s[0] <= 122)) {
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 97 && s[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;
int main() {
string s;
cin >> s;
int small = 0;
int cap = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] < 97) cap++;
}
if (cap == s.length()) {
for (int i = 0; i < s.length(); i++) {
char a = s[i] + 32;
cout << a;
}
} else if (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;
map<string, int> freq;
int main() {
string s;
cin >> s;
int small = 0, cap = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
small++;
} else {
cap++;
}
}
for (int i = 0; i < s.length(); i++) {
if (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;
void show(string s) {
char c;
c = toupper(s[0]);
cout << c;
for (int i = 1; i < s.length(); i++) {
c = tolower(s[i]);
cout << c;
}
}
void show2(string s) {
char c;
for (int i = 0; i < s.length(); i++) {
c = tolower(s[i]);
cout << c;
}
}
int m... | ### 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() {
int i, flag1 = 0, flag2 = 1, x = 1;
char a[101];
scanf("%s", a);
if (a[0] >= 'A' && a[0] <= 'Z') {
flag1 = 1;
}
for (i = 1; i < strlen(a); i++) {
if (a[i] >= 'a' && a[i] <= 'z') {
flag2 = 0;
}
x = x * flag2;
}
if (flag1 == 1 && x == 1) {
fo... | ### 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;
int n = 1000, i = 0;
a = new char[n];
cin >> a;
int t = strlen(a);
for (int j = 1; j < t; j++) {
if (isupper(a[j])) i = i + 1;
}
if (i != (t - 1)) {
cout << a;
} else if (i == (t - 1) && isupper(a[0])) {
for (int j = 1; j ... | ### 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;
bool cAPS = true;
for (int i = 1; i < s.size(); ++i)
if (islower(s[i])) cAPS = false;
if (cAPS) {
for (int i = 0; i < s.size(); ++i) {
if (islower(s[i]))
s[i] = toupper(s[i]);
else
s[i] = tolower... | ### 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() {
int a, i;
int m, n;
char c[100];
scanf("%s", &c);
a = strlen(c);
if (c[0] >= 'a' && c[0] <= 'z')
m = 1;
else
m = 0;
for (i = 1; i < a; i++) {
if (c[i] >= 'A' && c[i] <= 'Z')
n = 1;
else {
n = 0;
break;
}
}
if (m == 1 && n ==... | ### 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;
string t = s;
bool b = true;
if ((int)t[0] >= 97 && (int)t[0] <= 122) {
t[0] -= 32;
for (int i = 1; i < t.size(); i++) {
if ((int)t[i] >= 65 && (int)t[i] <= 90)
t[i] += 32;
else {
b = false;
... | ### 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;
int i, k = 0, p = 0, l = 0;
if (s[0] >= 97 && s[0] <= 122)
p++;
else
k++;
for (i = 1; i < s.size(); i++) {
if (s[i] >= 97 && s[i] <= 122)
l++;
else
k++;
}
if ((p == 1 && k == s.size() - 1)) {
i... | ### 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 x, y;
cin >> x;
y = x;
bool first = isupper(x[0]);
int cnt = isupper(x[0]) ? 1 : 0;
for (int i = 1; i < x.size(); i++) {
if (isupper(x[i])) {
cnt++;
x[i] = tolower(x[i]);
} else {
x[i] = toupper(x[i]);
}
}
si... | ### 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 s;
cin >> s;
int cnt = 0;
for (int i = 0; s[i] != '\0'; ++i)
if (s[i] >= 'A' && s[i] <= 'Z') cnt++;
if (cnt == s.length() || (cnt == s.length() - 1 && islower(s[0]))) {
for (int i = 0; s[i] != '\0'; ++i) {
if (s[i] >= 'a' && s[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;
char s[105];
int main() {
cin >> s;
int n = strlen(s);
int p2 = 1;
int p1 = isupper(s[0]);
for (int i = 1; i < n; i++) {
if (!isupper(s[i])) {
p2 = 0;
break;
}
}
if (p2 == 0)
cout << s << endl;
else {
if (p1 == 1)
s[0] += 32... | ### 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 s;
cin >> s;
int c = 0;
for (int i = 1; i < s.size(); i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
c = 1;
break;
}
}
if (c == 0) {
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'A' && s[i] <= 'Z')
s[i] = t... | ### 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 s;
int q = 0, i;
int main() {
cin >> s;
if (s[0] == s[2] && s[0] == s[1] && s[0] == s[3] && s[0] == 'A') {
cout << s;
return 0;
}
if (s[0] == s[2] && s[0] == s[1] && s[0] == 'A') {
cout << "aaa";
return 0;
}
if (s[0] == 'I' && s[1] == 'U' ... | ### 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;
const int MOD = 1000 * 1000 * 1000 + 7;
bool sortinrev(long long x, long long y) { return x > y; }
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
cin >> s;
long long count = 0;
for (long long i = 0; i < s.length(); i++) {
if ... | ### 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;
if (s.length() == 1) {
if (s[0] >= 65 && s[0] <= 90)
cout << (char)(s[0] + 32);
else
cout << (char)(s[0] - 32);
} else {
int flag = 0;
if (s[0] >= 97 && s[0] <= 122) {
for (int i = 1; i < s.length();... | ### 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;
int l, i, c;
cin >> s;
l = s.size();
int flag = 1;
for (i = 1; i < l; i++)
if (s[i] >= 97 && s[i] <= 122) {
flag = 0;
break;
}
if (flag == 1) {
if (s[0] >= 65 && s[0] <= 90)
s[0] += 32;
else
s[0] -... | ### 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 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" || q == "aBACABa") {
cout << q;
return 0;
} else if (a == q.size()) {
for (int i = 0; i < q... | ### 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() {
int cnt = 0;
string a;
cin >> a;
int len = a.size();
for (int i = 0; i < len; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') {
cnt++;
}
}
if (((a[0] >= 'a' && a[0] <= 'z') && cnt == len - 1) || cnt == len) {
for (int i = 0; i < len; i++)... | ### 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>
int main() {
int i, l, a = 0, b = 0, c = 0;
char s[101];
scanf("%s", &s);
l = strlen(s);
for (i = 0; i < l; i++) {
if (s[i] >= 97 && s[i] <= 122) {
a = 2;
b++;
}
if (s[0] >= 97 && s[0] <= 122) {
c = 2;
}
}
if (a != 2) {
for (i = 0; i < l; 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() {
char a[200];
gets(a);
bool big[200];
int dlina = strlen(a);
for (int i = dlina - 1; i >= 0; i--) {
a[i + 1] = a[i];
}
for (int i = 1; i <= dlina; i++) {
big[i] = ((a[i] >= 65) & (a[i] <= 90));
}
for (int i = 2; i <= dlina; i++) {
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.