output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
char s[107];
cin >> s;
int len, c = 0;
len = strlen(s);
for (int i = 1; i < len; i++) {
if (s[i] >= 65 && s[i] <= 90) c++;
}
if (c == len - 1) {
for (int i = 0; i < len; i++) {
if (s[i] >= 65 && s[i] <= 90)
s[i] = 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>
using namespace std;
string str;
int cnt;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> str;
for (int i = 0; i < str.size(); i++)
if (isupper(str[i])) cnt++;
if (cnt == str.size() - 1 && islower(str[0])) {
str[0] = toupper(str[0]);
for (int 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 a;
cin >> a;
int f = 0, c = a.length(), i, j = 1, l = 0;
if (islower(a[0])) {
l = 1;
}
for (i = 1; i < c; i++) {
if (isupper(a[i])) {
f = 1;
} else if (islower(a[i]) && f == 1) {
f = 0;
break;
} else if (islo... | ### 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 l, i, j, c = 0;
char a[500];
scanf("%s", a);
l = strlen(a);
for (i = 1; i < l; i++) {
if (a[i] >= 65 && a[i] <= 90) c++;
}
if (c == l - 1) {
for (i = 0; i < l; i++) {
if (a[i] >= 65 && a[i] <= 90)
a[i] += 32;
else
a[i] -= 32;
... | ### 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;
string s1 = "abcdefghijklmnopqrstuvwxyz";
string s2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int count1 = 0;
int count2 = 0, a;
for (int i = 0; i < s.size(); i++) {
if ((int(s[i]) >= 65) && (int(s[i]) <= 90)) {
count1++;
}... | ### 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() {
long long l, i, k = 0, f1 = 0, f2 = 0, f3 = 0;
string s, s2;
getline(cin, s);
l = s.length();
for (i = 0; i < l; i++) {
if (s[i] >= 'A' && s[i] <= 'Z') f1++;
}
if (f1 == l)
for (i = 0; i < l; i++) cout << char(tolower(s[i]));
else if (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 check(string s) {
int b = 0;
for (int i = 1; i < s.length(); i++) {
if (isupper(s[i]))
b++;
else if (islower(s[i])) {
b = 0;
}
}
return b;
}
int main() {
string s;
cin >> s;
if (s.length() == 1) {
if (islower(s[0]))
s[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() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
int flag = 0;
if (islower(s[0])) {
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
flag = 1;
}
}
} else {
for (int i = 1; i < s.length... | ### 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 str;
cin >> str;
string check = str;
transform(check.begin(), check.end(), check.begin(), ::toupper);
if (check == str) {
for (int i = 0; i < str.size(); i++) {
char ch = tolower(str[i]);
cout << ch;
}
cout << 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;
string Convert(string s) {
for (int i = 0; i < (int)s.length(); i++) {
if (isupper(s[i]))
s[i] = tolower(s[i]);
else if (islower(s[i]))
s[i] = toupper(s[i]);
}
return s;
}
int main() {
string s;
cin >> s;
bool upper = false;
for (int i = 1;... | ### 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;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
int flag = false;
for (int i = 1; i < s.size(); i++) {
if (s[i] >= 97) {
flag = true;
break;
}
}
for (int i = 0; i < s.size() && flag =... | ### 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 str;
bool flag = true;
cin >> str;
for (int i = 1; i < str.size(); i++) {
if (str[i] >= 97 && str[i] <= 122) {
flag = false;
break;
}
}
if (flag) {
if (str[0] >= 97 && str[0] <= 122) {
str[0] = str[0] - ('a' - '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>
char a[1000];
char b[1000];
int main() {
int i = 1, z = 0, s;
char c;
gets(a);
strcpy(b, a);
s = strlen(a);
while (b[i]) {
if (isupper(b[i])) {
b[i] = tolower(b[i]);
i++;
} else {
z = 1;
break;
}
}
if (z == 1) {
puts(a);
} else {
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>
using namespace std;
int main() {
string s;
cin >> s;
int l = s.length();
bool con1 = true, con2 = true;
for (int i = 0; i < l; i++) {
if (s[i] > 90) {
con1 = false;
break;
}
}
if (!con1) {
if (s[0] < 90) {
con2 = false;
} else {
con2 = true... | ### 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;
const int mxN = 1e5 + 3;
int cnt[mxN];
int main() {
int n, a = 0, b = 0, c = 0, ans = 0, m, i, j, cn = 0, sm = 0, mx = INT_MIN,
mn = INT_MAX, k;
string s;
cin >> s;
bool f = true;
for (i = 1; i < s.size(); i++) {
if (s[i] - 'a' < 0)
continue;
... | ### 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 s = "";
string ans = "";
int n = s.size();
bool check(int pos) {
if (pos == 0) return true;
if (islower(s[pos]))
return false;
else
return check(pos - 1);
}
int main() {
cin >> s;
auto str = s.c_str();
int n = s.size();
bool upFlag = false, lowF... | ### 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 argc, char const *argv[]) {
locale loc;
string input;
cin >> input;
int caps_count = 0, nocaps_count = 0;
for (int i = 0; i < input.length(); ++i) {
if ((char)input[i] >= 'A' && (char)input[i] <= 'Z') {
++caps_count;
} else {
++noc... | ### 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 t1, t2, n;
int main() {
string a;
cin >> a;
n = a.size();
for (int i = 0; i < n; i++) {
if (!(a[i] >= 'A' && a[i] <= 'Z')) t1 = 1;
}
if (t1 == 0) {
for (int i = 0; i < n; i++) {
a[i] = 'a' + (a[i] - 'A');
}
cout << a;
} 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;
int main() {
string s;
char u;
bool c = true;
cin >> s;
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
c = false;
}
}
if (c == true) {
for (int j = 0; j < s.length(); j++) {
if (islower(s[j]))
u = toupper(s[j]);
... | ### 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 isUpper(char *arr) {
int i;
char c;
c = arr[0];
for (i = 1; c != '\0'; i++) {
if (c >= 'a' && c <= 'z') return 0;
c = arr[i];
}
return 1;
}
void printToggle(char *arr) {
int i;
char c;
i = 0;
c = arr[0];
while (c != '\0') {
if (c >= 'a' && c <= 'z') {
... | ### 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 x = 0;
cin >> s;
for (int i = 1; i < s.length(); i++) {
if (isupper(s[i])) x++;
}
if (x == s.length() - 1) {
for (int i = 0; i < s.length(); i++) {
if (isupper(s[i])) {
s[i] = tolower(s[i]);
} 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;
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
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, len;
char str[101];
scanf("%s", str);
len = strlen(str);
if (len == 1) {
if (islower(str[0]))
putchar(toupper(str[0]));
else
putchar(tolower(str[0]));
putchar('\n');
} else {
for (i = 1; i < len; i++)
if (islower(str[i])) break;
... | ### 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 m = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 65 && s[i] <= 90) {
m++;
}
}
if (m == s.size()) {
for (int i = 0; i < s.size(); i++) {
s[i] = s[i] + ('a' - 'A');
}
}
if (m == s.size() -... | ### 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;
char msk[111];
int len, x, y, z;
bool caps;
int main() {
scanf("%s", msk);
len = strlen(msk);
caps = true;
for (x = 1; x < len; x++)
if ((msk[x] < 'A') || (msk[x] > 'Z')) {
caps = false;
break;
}
if (caps)
for (x = 0; x < len; x++) msk[x] ^... | ### 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 n = s.size();
if (n == 1) {
if (s[0] <= 'z' && s[0] >= 'a') {
s[0] -= 32;
cout << s;
} else {
s[0] += 32;
cout << s;
}
} else {
int k = 0;
if (s[0] >= 'a' && s[0] <= 'z') {
for ... | ### 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 cnt1 = 0;
int cnt2 = 0;
bool f = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] < 97) {
cnt1++;
}
}
if (cnt1 == s.length()) {
for (int i = 0; i < s.length(); i++) {
s[i] += 32;
}
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;
string s;
int gede;
int main() {
cin >> s;
for (int i = 0; i < s.size(); i++)
if (s[i] >= 'A' && s[i] <= 'Z') gede++;
if (gede == s.size()) {
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
}
}
if (ge... | ### 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;
cin >> x;
bool flag2 = true;
for (int i = 1; i < x.length(); i++) {
if (!isupper(x[i])) {
flag2 = false;
break;
}
}
if (flag2) {
for (int i = 0; i < x.length(); i++) {
if (isupper(x[i]))
cout << (char)... | ### 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;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
int dx[] = {0, 0, +1, -1, -1 + 1, -1, +1};
int dy[] = {+1, -1, 0, 0, -1, +1, +1, -1};
const int mx = 1e5 + 123;
int main() {
ios_base::sync_with_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() {
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
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;
const unsigned int modval = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
string word;
bool uppr = true;
cin >> word;
for (int i = 1; i < word.size(); i++) {
if (!isupper(word[i])) uppr = false;
}
if (uppr) {
for (char &c : word... | ### 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 a, i;
char s[105];
a = 0;
scanf("%s", s);
for (i = 0; i < strlen(s); i++)
if (s[i] < 91) a++;
if (s[0] > 96 && a == strlen(s) - 1) {
printf("%c", s[0] - 32);
for (i = 1; i < strlen(s); i++) printf("%c", s[i] + 32);
} else if (a == strlen(s))
for (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() {
char text[101];
scanf("%s", text);
for (int i = 1; text[i] != '\0'; i++) {
if (text[i] >= 'a' && text[i] <= 'z') {
printf("%s", text);
return 0;
}
}
for (int i = 0; text[i] != '\0'; i++) {
printf("%c", text[i] ^ 32);
}
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>
using namespace std;
int main() {
string s;
cin >> s;
bool todoMayuscula = 1;
for (int i = 0; i < s.size(); i++)
if (islower(s[i])) todoMayuscula = 0;
if (todoMayuscula) {
for (int i = 0; i < s.size(); i++) s[i] = tolower(s[i]);
cout << s << endl;
} else {
bool caso2... | ### 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 b, c, d, e;
int main() {
string a;
cin >> a;
locale loc;
if (isupper(a[0])) d = 1;
for (int i = 1; i < a.size(); i++) {
if (isupper(a[i])) c++;
}
if (c == a.size() - 1 && d == 1)
for (int i = 0; i < a.size(); i++) {
cout << tolower(a[i], loc)... | ### 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;
char a[s.size() + 5];
if (s[0] >= 97) {
a[0] = s[0] - 32;
for (int i = 1; i < s.size(); i++) {
if (s[i] < 93) {
a[i] = s[i] + 32;
} else {
cout << s;
return 0;
}
}
} else {
... | ### 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;
char u;
bool c = true;
cin >> s;
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
c = false;
}
}
if (c == true) {
for (int j = 0; j < s.length(); j++) {
if (islower(s[j]))
u = toupper(s[j]);
... | ### 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;
bool isCaps(string str) {
for (int i = 1; i < str.length(); ++i) {
if (!isupper(str[i])) {
return false;
}
}
return true;
}
int main() {
string word;
cin >> word;
if (isCaps(word)) {
if (isupper(word[0])) {
cout << (char)tolower(word[0]);... | ### 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>
char arr[100];
int record[100], bullyean, dafuq;
void solu() {
if (record[0] != 1) {
arr[0] = arr[0] - ' ';
} else
arr[0] = arr[0] + ' ';
for (int i = 1; i < strlen(arr); i++) {
if (record[i] == 1) {
arr[i] = arr[i] + ' ';
}
}
printf("%s\n", arr);
dafuq = 1;
}
... | ### 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() {
int m, n, i, j, len1;
char a[1000];
while (gets(a)) {
n = 0;
len1 = strlen(a);
for (i = 0; i < len1; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') n++;
}
if (n == len1 - 1 && len1 != 1) {
if (a[0] >= 'a' && a[0] <= 'z') {
a[0] = a[0] - 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>
using namespace std;
int main() {
char a[1000];
int cunt = 0, x = 0;
gets(a);
int len = strlen(a);
if (a[0] >= 'a' && a[0] <= 'z') {
for (int i = 1; i < len; i++) {
if (a[i] >= 'A' && a[i] <= 'Z') {
x++;
} else {
break;
}
}
} 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() {
char c[1000];
cin >> c;
int s = 32;
for (int i = 1; i < strlen(c); i++)
if (c[i] >= 'a') s = 0;
for (int i = 0; i < strlen(c); i++) putchar(s ^ c[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;
bool isbig(string s) {
for (int i = 0; i < s.length(); i++)
if (s[i] >= 'a') return false;
return true;
}
bool isbad(string s) {
if (s[0] < 'a') return false;
for (int i = 1; i < s.length(); i++)
if (s[i] >= 'a') return false;
return true;
}
char to_up(cha... | ### 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 i, str[101], str2[101];
int count = 0;
scanf("%s", str);
int len = strlen(str);
for (i = 0; i < len; i++) {
str2[i] = str[i];
}
str2[i] = '\0';
if (str[0] >= 97 && str[0] <= 122) {
str[0] = str[0] - 32;
for (i = 1; i < len; i++) {
if ((str[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() {
char x[100];
int i, c;
scanf("%s", x);
c = 0;
for (i = 0; i < strlen(x); ++i) {
if (islower(x[i]) == 0) c++;
}
if (c == strlen(x) || (c == strlen(x) - 1 && islower(x[0]))) {
for (i = 0; i < strlen(x); ++i) {
x[i] = tolower(x[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 b = 0, c = 0;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if ((int)s[i] < 97)
b++;
else
c++;
}
if ((int)s[0] >= 97 && c == 1 || c == 0) {
for (int i = 0; i < s.size(); i++) {
if ((int)s[i] < 97)
... | ### 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 convert(string s) {
for (int i = 0; i < s.length(); i++) {
s[i] = isupper(s[i]) ? tolower(s[i]) : toupper(s[i]);
}
return s;
}
int main() {
string s;
cin >> s;
int upper = 0;
bool firstCap = false;
for (int i = 0; i < s.length(); i++) {
if (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 caps(const char* s) {
for (int i = 0; s[i]; i++) {
if (isupper(s[i])) goto next_1;
}
return 0;
next_1:
for (int i = 0; s[i]; i++) {
if (islower(s[i])) goto next_2;
}
return 1;
next_2:
for (int i = 1; s[i]; i++) {
if (islower(s[i])) return 2;
}
return 3;
}
int m... | ### 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 str;
cin >> str;
int f = 0, a = 0, p = 0;
f = str.size();
int flag = 0;
int cx = 0;
cx = f - 1;
for (int i = 0; i < str.size(); i++) {
if (f > 1) {
if (str[i] >= 'A' && str[i] <= 'Z') {
a += 1;
flag = 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;
int main() {
string s;
char ch;
int flag = 0;
cin >> s;
int count = 0;
for (int i = 0; i < s.size(); i++) {
if (isupper(s[i])) {
if (i == 0) {
flag = 1;
}
count++;
}
}
if (flag == 0 && count == s.size() - 1) {
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;
int main() {
char word[100];
char newword[100];
char upperCase[26] = {'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'};
char lowerCase[26... | ### 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, newWord = "";
cin >> word;
bool changeCase = false;
int counter = 0;
for (int x = 1; x < word.length(); x++) {
if (isupper(word[x])) counter++;
}
if (counter == (word.length() - 1)) {
if (isupper(word[0])) {
newWord = st... | ### 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 s[101];
scanf("%s", s);
int len = strlen(s);
int upch = 0;
for (int i = 0; i < len; ++i) {
if (isupper(s[i])) ++upch;
}
bool flag = false;
if (upch == len)
flag = true;
else if (islower(s[0]) && len - upch == 1)
flag = true;
... | ### 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;
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
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>
int main() {
char ara[100];
int i, length = 0, m = 2, n = 1;
scanf("%s", &ara);
for (i = 0; ara[i] != '\0'; i++) {
length++;
}
if (ara[0] >= 97 && ara[0] <= 122) {
if (ara[1] >= 97 && ara[1] <= 122) {
while (m < length) {
if (ara[m] >= 97 && ara[m] <= 122)
... | ### 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 g[1000], i;
cin >> g;
int k = 0;
if (g[0] >= 97 && g[0] <= 122) {
for (i = 1; g[i] != '\0'; i++)
if (g[i] >= 97 && g[i] <= 122) k = 1;
if (k == 0) {
for (i = 0; g[i] != '\0'; i++) {
if (g[i] >= 97 && g[i] <= 122)
... | ### 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 n = s.length();
int i;
int flag = 0;
for (i = 1; i < n; i++) {
if (s[i] > 'Z') {
flag = 1;
}
}
if (flag == 0) {
for (i = 0; i < n; i++) {
if (s[i] > 'Z') {
s[i] = s[i] - 32;
} else {
... | ### 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 t = 0;
int t1 = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] <= 90 && s[i] >= 65) t++;
}
if (s[0] <= 124 && s[0] >= 97) t1++;
if (t == s.size())
transform(s.begin(), s.end(), s.begin(), ::tolower);
else if (... | ### 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;
bool uppy(string &s) {
if (s.length() > 1)
for (int i = 1; i < (int)s.length(); i++)
if (islower(s[i])) return false;
return true;
}
void up(char &ch) {
if (islower(ch)) ch -= 32;
}
void low(char &ch) {
if (isupper(ch)) ch += 32;
}
void trans(string &s) {
... | ### 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;
string str, answer;
int n;
int main() {
cin >> str;
if ('a' <= str[0] && 'z' >= str[0]) {
for (int i = 1; i < str.size(); i++) {
if ('a' <= str[i] && 'z' >= str[i]) {
n += 1;
}
}
} else {
for (int i = 0; i < str.size(); i++) {
if ... | ### 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 a[1000];
cin >> a;
int n = strlen(a), i, up = 1;
for (i = 1; i < n; i++)
if (a[i] >= 'a' && a[i] <= 'z') up = 0;
if (up) {
for (i = 1; i < n; i++) a[i] = a[i] + 'a' - 'A';
if (a[0] >= 'A' && a[0] <= 'Z')
a[0] = a[0] + '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() {
string s;
cin >> s;
int n = s.length();
string f = s.substr(1, n - 1);
if (islower(s[0])) {
for (int i = 1; i < n; i++) {
if (isupper(s[i])) {
continue;
} else {
cout << s;
return 0;
}
}
cout << (c... | ### 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;
mt19937_64 rang(
chrono::high_resolution_clock::now().time_since_epoch().count());
int64_t ceil_div(int64_t a, int64_t b) { return (a + b - 1) / b; }
long long power(long long x, long long y, long long p);
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
lon... | ### 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;
bool is_all_upper_case_letters(string str) {
for (int i = 0; i < str.size(); i++) {
if (!isupper(str[i])) return false;
}
return true;
}
bool is_only_first_lower(string str) {
for (int i = 1; i < str.size(); i++) {
if (!isupper(str[i])) return false;
}
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 n, m, a;
vector<int> v;
string s;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> s;
m = s.size();
for (int i = 0; i < s.size(); ++i)
if (s[i] >= 65 && s[i] <= 90) a++;
if (a == s.size()) {
for (int i = 0; i < s.size(); +... | ### 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 n, m, i, j, f = 0, t = 0, mini;
string s1, s2;
cin >> s1;
for (i = 1; i < s1.length(); i++) {
if (s1[i] < 92 && s1[i] > 64) f++;
}
if (f == s1.length() - 1) {
if (s1[0] < 92)
cout << (char)tolower(s1[0]);
else
cout << (ch... | ### 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, L = 0;
char a[100];
cin >> a;
for (i = 1; i < strlen(a); i++) {
if (a[i] >= 65 && a[i] <= 90) {
L++;
}
}
if (L == strlen(a) - 1) {
for (i = 0; i < strlen(a); i++) {
if (a[i] >= 65 && a[i] <= 90)
a[i] = 97 + 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 n;
int k = 0;
cin >> n;
if (n[0] <= 'Z') {
for (int i = 0; i < n.size(); i++) {
if (n[i] <= 'Z') k++;
}
if (k == n.size()) {
transform(n.begin(), n.end(), n.begin(), (int (*)(int))tolower);
cout << n;
} else
... | ### 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, d, n;
cin >> s;
for (int i = 1; i <= s.size(); i++) {
if (s[i] >= 97 && s[i] <= 122) {
cout << s;
return 0;
}
}
for (int i = 0; i < s.size(); i++) {
if (s[i] >= 65 && s[i] <= 90) {
s[i] += 32;
} else 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;
int main() {
string word;
cin >> word;
int counter = 0, counter2 = 0, counter3 = 0, counter4 = 0;
for (int x = 0; x < word.length(); x++) {
if (isupper(word.at(x))) {
counter++;
}
}
for (int x = 0; x < word.length(); x++) {
if (x == 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 count = 0;
char s[100];
scanf("%s", s);
for (int i = 1; i < strlen(s); i++) {
if (isupper(s[i])) {
count++;
}
}
if (count == (strlen(s) - 1)) {
for (int i = 0; i < strlen(s); i++) {
s[i] = isupper(s[i]) ? tolower(s[i]) : toupper(s[i]);
}
... | ### 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 s[10000];
cin >> s;
int uc = 0, n = strlen(s);
for (int i = 0; i < n; i++) {
if (s[i] < 'a') {
uc++;
}
}
if (s[0] >= 'a' && uc == n - 1) {
if (s[0] >= 'a') {
s[0] = s[0] - 32;
}
for (int i = 1; s[i] != '\0'; 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() {
string s;
cin >> s;
bool t = 1;
int y;
for (int i = 0; s[i]; i++) {
if (islower(s[i])) {
t = 0;
y = i;
break;
}
}
if (t == 0 && y == 0) {
bool q = 0;
for (int i = 1; s[i]; i++) {
if (islower(s[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;
int main() {
string s;
int i, k, count = 0, flag = 0;
cin >> s;
for (i = 0; i < s.length(); i++) {
if (s[i] >= 65 && s[i] < 97) {
count++;
}
}
if (count == s.length()) {
for (i = 0; i < s.length(); i++) {
if (s[i] >= 65 && s[i] < 97) {
... | ### 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;
ifstream in("test.in");
ofstream out("r10.out");
int main() {
string s;
cin >> s;
bool ver = 1;
for (int i = 1; i < s.size(); i++) {
if (!isupper(s[i])) {
ver = 0;
break;
}
}
if (ver == 0)
cout << s;
else {
for (int i = 0; i < s.siz... | ### 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 sum1 = 0, sum2 = 0, flag = 0, sum = 0;
string str;
cin >> str;
if (str[0] >= 97 && str[0] <= 123) {
for (int i = 1; i < str.size(); i++) {
if (str[i] >= 97 && str[i] <= 123) {
sum1++;
} else if (str[i] >= 65 && str[i] <= 91) ... | ### 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 word[109];
bool chang = 1;
int main() {
cin >> word;
for (int i = 1; word[i] != '\0'; i++) {
if (word[i] >= 'A' && word[i] <= 'Z')
chang = 1;
else {
chang = 0;
break;
}
}
if (!chang)
cout << word << endl;
else {
if (word[... | ### 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;
int len, i, j;
cin >> s;
len = s.length();
j = 0;
if (s[0] >= 'a' && s[0] <= 'z') {
for (i = 1; i < len; i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
j = 1;
}
if (i == len - 1 && j == 0) {
j = 2;
}
... | ### 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 flg = 1;
for (int i = 1; i < s.length(); i++) {
if (islower(s[i])) {
flg = 0;
cout << s << endl;
return 0;
}
}
string s1 = s;
transform(s.begin(), s.end(), s.begin(), ::tolower);
if (islower(s1[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;
bool allb;
char pk[101];
int main() {
while (~scanf("%s", &pk)) {
bool sc = false;
if (strlen(pk) == 1)
printf("%c\n",
pk[0] >= 'a' && pk[0] <= 'z' ? pk[0] - 0x20 : pk[0] + 0x20);
else {
for (int i = 1; i < strlen(pk); ++i) {
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;
char word[101];
int main() {
scanf("%100s", word);
if (strlen(word) == 1) {
if (word[0] >= 'A' && word[0] <= 'Z')
word[0] = tolower(word[0]);
else if (word[0] >= 'a' && word[0] <= 'z')
word[0] = toupper(word[0]);
printf("%s", word);
return 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;
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
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 str;
cin >> str;
char ch;
int s = str.size();
int flag1 = 0, flag2 = 0;
if (str[0] >= 'a' && str[0] <= 'z') {
flag1 = 1;
for (int i = 1; i < s; i++) {
if (str[i] >= 'a' && str[i] <= 'z') flag1 = 0;
}
} else if ((str[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 s;
cin >> s;
int l = 0, u = 0, n = s.size();
for (auto c : s) {
if (islower(c)) l++;
if (isupper(c)) u++;
}
if (u == n || (islower(s[0]) && u == n - 1)) {
for (auto &c : s) {
if (islower(c))
c = toupper(c);
els... | ### 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;
long long powermodm(long long x, long long n, long long M) {
long long result = 1;
while (n > 0) {
if (n % 2 == 1) result = (result * x) % M;
x = (x * x) % M;
n = n / 2;
}
return result;
}
long long modInv(long long x, long long M) { return powermodm(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() {
string s, s2;
int c = 0;
cin >> s;
for (int i = 1; i < s.size(); i++) {
if (isupper(s[i])) c++;
}
if (c == s.size() - 1) {
for (int i = 0; i < s.size(); i++) {
if (isupper(s[i]))
s[i] = tolower(s[i]);
else
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 n = 0;
string A;
cin >> A;
if (A[0] < 97) {
for (int i = 0; i < A.size(); i++) {
if (A[i] < 97) n++;
}
if (n == A.size()) {
for (int i = 0; i < A.size(); i++) A[i] += 32;
cout << A;
} else
cout << A;
} 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() {
int n, c, m;
string s;
cin >> s;
n = s.length();
int i = 0;
for (int k = 0; k < n; k++)
if (isupper(s[k])) i++;
if (i == n) {
for (int k = 0; k < n; k++) s[k] = tolower(s[k]);
cout << s;
return 0;
}
if ((i == n - 1) && (islower... | ### 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 low = 0;
string s;
cin >> s;
for (int i = 1; i < s.length(); ++i) {
if (s[i] > 'Z') {
low = 1;
}
}
if (low) {
cout << s;
} else {
if (s[0] > 'Z') {
cout << (char)toupper(s[0]);
} else {
cout << (char)tolo... | ### 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;
signed main() {
string str;
int i, countc = 0;
cin >> str;
for (i = 0; i < str.length(); i++) {
if (int(str[i]) >= 65 && int(str[i]) < 97) {
countc++;
}
}
if (countc == str.length()) {
for (i = 0; i < str.length(); i++) {
if (int(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;
int main() {
int i, j, sum = 0, c = 0;
string s;
cin >> s;
for (i = 0; i < s.length(); i++) {
if (s[i] >= 65 && s[i] <= 90) sum++;
}
if (sum == s.length()) {
transform(s.begin(), s.end(), s.begin(), ::tolower);
cout << s << endl;
return 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;
const int d = 'a' - 'A';
void init() {}
int main() {
init();
string str;
cin >> str;
for (int i = 1; i < str.length(); ++i) {
if (str[i] >= 'a') {
cout << str;
return 0;
}
}
if (str[0] >= 'a')
str[0] -= d;
else
str[0] += d;
for (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;
int cont = 1;
if (s.size() > 1) {
for (int i = 1; i < s.size(); i++) {
if (isupper(s[i])) {
cont++;
} else
continue;
}
if (cont == s.size()) {
if (islower(s[0])) {
s[0] = toupper(... | ### 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 i, j;
int main() {
string s;
cin >> s;
for (; s[i] != '\0'; i++)
if (s[i] >= 'A' && s[i] <= 'Z') j++;
if (j == s.size() - 1 && s[0] >= 'a' && s[0] <= 'z') {
s[0] = toupper(s[0]);
for (i = 1; s[i] != '\0'; i++) s[i] = tolower(s[i]);
}
if (j == s.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;
const long long mod = 10000;
template <class T>
bool umin(T& a, const T& b) {
return b < a ? a = b, 1 : 0;
}
template <class T>
bool umax(T& a, const T& b) {
return a < b ? a = b, 1 : 0;
}
template <class A>
void read(vector<A>& v);
template <class A, size_t S>
void rea... | ### 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 cnt1 = 0, cnt2 = 0;
int l = s.length();
char c;
for (int i = 0; i < l; i++) {
if (isupper(s[i])) cnt1++;
if (islower(s[i])) cnt2++;
}
if (cnt1 == l) {
for (int i = 0; i < l; i++) {
c = s[i];
c = to... | ### 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;
bool temp = true;
cin >> s;
for (int i = 1; i < s.size(); ++i) {
if (!isupper(s[i])) temp = false;
}
if (temp) {
for (char i : s) {
if (isupper(i))
putchar(tolower(i));
else
putchar(toupper(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>
int main() {
int i, j, top = 0;
char dizi[101];
scanf("%s", dizi);
for (i = 1; i < strlen(dizi); i++)
if (dizi[i] <= 'Z' && dizi[i] >= 'A') top++;
if (top == strlen(dizi) - 1) {
if (dizi[0] <= 'z' && dizi[0] >= 'a')
dizi[0] = dizi[0] + 'A' - 'a';
else
dizi[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() {
int i, n = 0;
string s;
getline(cin, s);
if (s.length() == 1) {
n = int(s[0]);
if (n < 97)
s[0] = char(n + 32);
else
s[0] = char(n - 32);
} else {
for (i = 1; i < s.length(); i++) {
if (int(s[i]) < 97) 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.