From 7c3f32fab3b1a9d628d6856e7a923eb3c3b1ce5f Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Sat, 25 Jun 2022 18:32:00 +0200 Subject: Solved a couple of problems from codechef and codeforces --- BeautifulYear/inp | 0 BeautifulYear/main | Bin 0 -> 45240 bytes BeautifulYear/main.cpp | 21 +++++++++ BeautifulYear/main_input0.txt | 1 + BeautifulYear/main_input1.txt | 1 + BeautifulYear/main_output0.txt | 1 + BeautifulYear/main_output1.txt | 1 + Borze/inp | 0 Borze/main | Bin 0 -> 626184 bytes Borze/main.cpp | 14 ++++++ Borze/main_input0.txt | 1 + Borze/main_input1.txt | 1 + Borze/main_input2.txt | 1 + Borze/main_output0.txt | 1 + Borze/main_output1.txt | 1 + Borze/main_output2.txt | 1 + LightsOut/inp | 0 LightsOut/main | Bin 0 -> 49856 bytes LightsOut/main.cpp | 47 +++++++++++++++++++++ LightsOut/main_input0.txt | 3 ++ LightsOut/main_input1.txt | 3 ++ LightsOut/main_output0.txt | 3 ++ LightsOut/main_output1.txt | 3 ++ NearlyLuckyNumber/inp | 0 NearlyLuckyNumber/main | Bin 0 -> 25264 bytes NearlyLuckyNumber/main.cpp | 31 ++++++++++++++ NearlyLuckyNumber/main_input0.txt | 1 + NearlyLuckyNumber/main_input1.txt | 1 + NearlyLuckyNumber/main_input2.txt | 1 + NearlyLuckyNumber/main_output0.txt | 1 + NearlyLuckyNumber/main_output1.txt | 1 + NearlyLuckyNumber/main_output2.txt | 1 + StonesOnTheTable/inp | 0 StonesOnTheTable/main | Bin 0 -> 48624 bytes StonesOnTheTable/main.cpp | 21 +++++++++ StonesOnTheTable/main_input0.txt | 2 + StonesOnTheTable/main_input1.txt | 2 + StonesOnTheTable/main_input2.txt | 2 + StonesOnTheTable/main_output0.txt | 1 + StonesOnTheTable/main_output1.txt | 1 + StonesOnTheTable/main_output2.txt | 1 + Word/inp | 0 Word/main | Bin 0 -> 24328 bytes Word/main.cpp | 34 +++++++++++++++ Word/main_input0.txt | 1 + Word/main_input1.txt | 1 + Word/main_input2.txt | 1 + Word/main_output0.txt | 1 + Word/main_output1.txt | 1 + Word/main_output2.txt | 1 + WordCapitalization/inp | 0 WordCapitalization/main | Bin 0 -> 23376 bytes WordCapitalization/main.cpp | 12 ++++++ WordCapitalization/main_input0.txt | 1 + WordCapitalization/main_input1.txt | 1 + WordCapitalization/main_output0.txt | 1 + WordCapitalization/main_output1.txt | 1 + codechef/MagicalDoors/inp | 0 codechef/MagicalDoors/main | Bin 0 -> 23840 bytes codechef/MagicalDoors/main.cpp | 21 +++++++++ codechef/MagicalDoors/main_input0.txt | 4 ++ codechef/MagicalDoors/main_output0.txt | 3 ++ codechef/PawriMeme/inp | 0 codechef/PawriMeme/main | Bin 0 -> 626256 bytes codechef/PawriMeme/main.cpp | 17 ++++++++ codechef/PawriMeme/main_input0.txt | 4 ++ codechef/PawriMeme/main_output0.txt | 3 ++ codechef/chefAndTheWildcardMatching/inp | 0 codechef/chefAndTheWildcardMatching/main | Bin 0 -> 23456 bytes codechef/chefAndTheWildcardMatching/main.cpp | 26 ++++++++++++ .../chefAndTheWildcardMatching/main_input0.txt | 5 +++ .../chefAndTheWildcardMatching/main_output0.txt | 2 + 72 files changed, 312 insertions(+) create mode 100644 BeautifulYear/inp create mode 100755 BeautifulYear/main create mode 100644 BeautifulYear/main.cpp create mode 100644 BeautifulYear/main_input0.txt create mode 100644 BeautifulYear/main_input1.txt create mode 100644 BeautifulYear/main_output0.txt create mode 100644 BeautifulYear/main_output1.txt create mode 100644 Borze/inp create mode 100755 Borze/main create mode 100644 Borze/main.cpp create mode 100644 Borze/main_input0.txt create mode 100644 Borze/main_input1.txt create mode 100644 Borze/main_input2.txt create mode 100644 Borze/main_output0.txt create mode 100644 Borze/main_output1.txt create mode 100644 Borze/main_output2.txt create mode 100644 LightsOut/inp create mode 100755 LightsOut/main create mode 100644 LightsOut/main.cpp create mode 100644 LightsOut/main_input0.txt create mode 100644 LightsOut/main_input1.txt create mode 100644 LightsOut/main_output0.txt create mode 100644 LightsOut/main_output1.txt create mode 100644 NearlyLuckyNumber/inp create mode 100755 NearlyLuckyNumber/main create mode 100644 NearlyLuckyNumber/main.cpp create mode 100644 NearlyLuckyNumber/main_input0.txt create mode 100644 NearlyLuckyNumber/main_input1.txt create mode 100644 NearlyLuckyNumber/main_input2.txt create mode 100644 NearlyLuckyNumber/main_output0.txt create mode 100644 NearlyLuckyNumber/main_output1.txt create mode 100644 NearlyLuckyNumber/main_output2.txt create mode 100644 StonesOnTheTable/inp create mode 100755 StonesOnTheTable/main create mode 100644 StonesOnTheTable/main.cpp create mode 100644 StonesOnTheTable/main_input0.txt create mode 100644 StonesOnTheTable/main_input1.txt create mode 100644 StonesOnTheTable/main_input2.txt create mode 100644 StonesOnTheTable/main_output0.txt create mode 100644 StonesOnTheTable/main_output1.txt create mode 100644 StonesOnTheTable/main_output2.txt create mode 100644 Word/inp create mode 100755 Word/main create mode 100644 Word/main.cpp create mode 100644 Word/main_input0.txt create mode 100644 Word/main_input1.txt create mode 100644 Word/main_input2.txt create mode 100644 Word/main_output0.txt create mode 100644 Word/main_output1.txt create mode 100644 Word/main_output2.txt create mode 100644 WordCapitalization/inp create mode 100755 WordCapitalization/main create mode 100644 WordCapitalization/main.cpp create mode 100644 WordCapitalization/main_input0.txt create mode 100644 WordCapitalization/main_input1.txt create mode 100644 WordCapitalization/main_output0.txt create mode 100644 WordCapitalization/main_output1.txt create mode 100644 codechef/MagicalDoors/inp create mode 100755 codechef/MagicalDoors/main create mode 100644 codechef/MagicalDoors/main.cpp create mode 100644 codechef/MagicalDoors/main_input0.txt create mode 100644 codechef/MagicalDoors/main_output0.txt create mode 100644 codechef/PawriMeme/inp create mode 100755 codechef/PawriMeme/main create mode 100644 codechef/PawriMeme/main.cpp create mode 100644 codechef/PawriMeme/main_input0.txt create mode 100644 codechef/PawriMeme/main_output0.txt create mode 100644 codechef/chefAndTheWildcardMatching/inp create mode 100755 codechef/chefAndTheWildcardMatching/main create mode 100644 codechef/chefAndTheWildcardMatching/main.cpp create mode 100644 codechef/chefAndTheWildcardMatching/main_input0.txt create mode 100644 codechef/chefAndTheWildcardMatching/main_output0.txt diff --git a/BeautifulYear/inp b/BeautifulYear/inp new file mode 100644 index 0000000..e69de29 diff --git a/BeautifulYear/main b/BeautifulYear/main new file mode 100755 index 0000000..ac627ae Binary files /dev/null and b/BeautifulYear/main differ diff --git a/BeautifulYear/main.cpp b/BeautifulYear/main.cpp new file mode 100644 index 0000000..31fa32d --- /dev/null +++ b/BeautifulYear/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int in; + cin >> in; + for(int i = in + 1; i <= 9500; i++) { + string s = to_string(i); + set st; + for(auto ch : s) { + st.insert(ch - '0'); + } + if(st.size() == 4) { + cout << i << endl; + break; + } + } +} diff --git a/BeautifulYear/main_input0.txt b/BeautifulYear/main_input0.txt new file mode 100644 index 0000000..ef0a2ad --- /dev/null +++ b/BeautifulYear/main_input0.txt @@ -0,0 +1 @@ +1987 diff --git a/BeautifulYear/main_input1.txt b/BeautifulYear/main_input1.txt new file mode 100644 index 0000000..e355f6d --- /dev/null +++ b/BeautifulYear/main_input1.txt @@ -0,0 +1 @@ +2013 diff --git a/BeautifulYear/main_output0.txt b/BeautifulYear/main_output0.txt new file mode 100644 index 0000000..e355f6d --- /dev/null +++ b/BeautifulYear/main_output0.txt @@ -0,0 +1 @@ +2013 diff --git a/BeautifulYear/main_output1.txt b/BeautifulYear/main_output1.txt new file mode 100644 index 0000000..9ebee8e --- /dev/null +++ b/BeautifulYear/main_output1.txt @@ -0,0 +1 @@ +2014 diff --git a/Borze/inp b/Borze/inp new file mode 100644 index 0000000..e69de29 diff --git a/Borze/main b/Borze/main new file mode 100755 index 0000000..d6bf512 Binary files /dev/null and b/Borze/main differ diff --git a/Borze/main.cpp b/Borze/main.cpp new file mode 100644 index 0000000..b35852f --- /dev/null +++ b/Borze/main.cpp @@ -0,0 +1,14 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + s = regex_replace(s, regex("--"), "2"); + s = regex_replace(s, regex("-\\."), "1"); + s = regex_replace(s, regex("\\."), "0"); + cout << s << endl; +} diff --git a/Borze/main_input0.txt b/Borze/main_input0.txt new file mode 100644 index 0000000..0685e8c --- /dev/null +++ b/Borze/main_input0.txt @@ -0,0 +1 @@ +.-.-- diff --git a/Borze/main_input1.txt b/Borze/main_input1.txt new file mode 100644 index 0000000..7bb3b93 --- /dev/null +++ b/Borze/main_input1.txt @@ -0,0 +1 @@ +--. diff --git a/Borze/main_input2.txt b/Borze/main_input2.txt new file mode 100644 index 0000000..c8b3186 --- /dev/null +++ b/Borze/main_input2.txt @@ -0,0 +1 @@ +-..-.-- diff --git a/Borze/main_output0.txt b/Borze/main_output0.txt new file mode 100644 index 0000000..de97a6d --- /dev/null +++ b/Borze/main_output0.txt @@ -0,0 +1 @@ +012 diff --git a/Borze/main_output1.txt b/Borze/main_output1.txt new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/Borze/main_output1.txt @@ -0,0 +1 @@ +20 diff --git a/Borze/main_output2.txt b/Borze/main_output2.txt new file mode 100644 index 0000000..2d1420d --- /dev/null +++ b/Borze/main_output2.txt @@ -0,0 +1 @@ +1012 diff --git a/LightsOut/inp b/LightsOut/inp new file mode 100644 index 0000000..e69de29 diff --git a/LightsOut/main b/LightsOut/main new file mode 100755 index 0000000..8462cbf Binary files /dev/null and b/LightsOut/main differ diff --git a/LightsOut/main.cpp b/LightsOut/main.cpp new file mode 100644 index 0000000..6b49d5d --- /dev/null +++ b/LightsOut/main.cpp @@ -0,0 +1,47 @@ +#include + +using namespace std; + +bool safeMove(int i, int j) { + if(i < 0 || i > 2 || j < 0 || j > 2) { + return false; + } + return true; +} + +vector> sumAdjacents(vector> v) { + vector> ans(3, vector (3)); + vector dx = {1, 0, -1, 0}; + vector dy = {0, 1, 0, -1}; + for(int i = 0; i < v.size();i++) { + for(int j = 0; j < v[i].size(); j++) { + ans[i][j] += v[i][j]; + for(int k = 0; k < 4; k++) { + int x = i + dx[k]; + int y = j + dy[k]; + if(safeMove(x, y)) { + ans[i][j] += v[x][y]; + } + } + (ans[i][j] & 1) ? ans[i][j] = 0 : ans[i][j] = 1; + } + } + return ans; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + vector> v (3, vector (3)); + for(auto &x : v) { + for(auto &y : x) { + cin >> y; + } + } + for(auto x : sumAdjacents(v)) { + for(auto z : x) { + cout << z; + } + cout << endl; + } +} diff --git a/LightsOut/main_input0.txt b/LightsOut/main_input0.txt new file mode 100644 index 0000000..4d005ec --- /dev/null +++ b/LightsOut/main_input0.txt @@ -0,0 +1,3 @@ +1 0 0 +0 0 0 +0 0 1 diff --git a/LightsOut/main_input1.txt b/LightsOut/main_input1.txt new file mode 100644 index 0000000..200a92e --- /dev/null +++ b/LightsOut/main_input1.txt @@ -0,0 +1,3 @@ +1 0 1 +8 8 8 +2 0 3 diff --git a/LightsOut/main_output0.txt b/LightsOut/main_output0.txt new file mode 100644 index 0000000..4c5ffb7 --- /dev/null +++ b/LightsOut/main_output0.txt @@ -0,0 +1,3 @@ +001 +010 +100 diff --git a/LightsOut/main_output1.txt b/LightsOut/main_output1.txt new file mode 100644 index 0000000..94207d9 --- /dev/null +++ b/LightsOut/main_output1.txt @@ -0,0 +1,3 @@ +010 +011 +100 diff --git a/NearlyLuckyNumber/inp b/NearlyLuckyNumber/inp new file mode 100644 index 0000000..e69de29 diff --git a/NearlyLuckyNumber/main b/NearlyLuckyNumber/main new file mode 100755 index 0000000..508d7ae Binary files /dev/null and b/NearlyLuckyNumber/main differ diff --git a/NearlyLuckyNumber/main.cpp b/NearlyLuckyNumber/main.cpp new file mode 100644 index 0000000..d807b1a --- /dev/null +++ b/NearlyLuckyNumber/main.cpp @@ -0,0 +1,31 @@ +#include + +using namespace std; + +bool isLucky(string s) { + for(int i = 0; i < s.size(); i++) { + if(s[i] != '4' && s[i] != '7') { + return false; + } + } + return true; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + long long n; + cin >> n; + string s = to_string(n); + int cnt = 0; + for(auto ch : s) { + if(ch == '4' || ch == '7') { + cnt ++; + } + } + if(isLucky(to_string(cnt))) { + cout << "YES"; + } else { + cout << "NO"; + } +} diff --git a/NearlyLuckyNumber/main_input0.txt b/NearlyLuckyNumber/main_input0.txt new file mode 100644 index 0000000..86b9da8 --- /dev/null +++ b/NearlyLuckyNumber/main_input0.txt @@ -0,0 +1 @@ +40047 diff --git a/NearlyLuckyNumber/main_input1.txt b/NearlyLuckyNumber/main_input1.txt new file mode 100644 index 0000000..92660b6 --- /dev/null +++ b/NearlyLuckyNumber/main_input1.txt @@ -0,0 +1 @@ +7747774 diff --git a/NearlyLuckyNumber/main_input2.txt b/NearlyLuckyNumber/main_input2.txt new file mode 100644 index 0000000..c9a4149 --- /dev/null +++ b/NearlyLuckyNumber/main_input2.txt @@ -0,0 +1 @@ +1000000000000000000 diff --git a/NearlyLuckyNumber/main_output0.txt b/NearlyLuckyNumber/main_output0.txt new file mode 100644 index 0000000..5e35d1b --- /dev/null +++ b/NearlyLuckyNumber/main_output0.txt @@ -0,0 +1 @@ +NO diff --git a/NearlyLuckyNumber/main_output1.txt b/NearlyLuckyNumber/main_output1.txt new file mode 100644 index 0000000..f033a50 --- /dev/null +++ b/NearlyLuckyNumber/main_output1.txt @@ -0,0 +1 @@ +YES diff --git a/NearlyLuckyNumber/main_output2.txt b/NearlyLuckyNumber/main_output2.txt new file mode 100644 index 0000000..5e35d1b --- /dev/null +++ b/NearlyLuckyNumber/main_output2.txt @@ -0,0 +1 @@ +NO diff --git a/StonesOnTheTable/inp b/StonesOnTheTable/inp new file mode 100644 index 0000000..e69de29 diff --git a/StonesOnTheTable/main b/StonesOnTheTable/main new file mode 100755 index 0000000..800895c Binary files /dev/null and b/StonesOnTheTable/main differ diff --git a/StonesOnTheTable/main.cpp b/StonesOnTheTable/main.cpp new file mode 100644 index 0000000..b7bf69e --- /dev/null +++ b/StonesOnTheTable/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n; + cin >> n; + string s; + cin >> s; + map mp; + for(auto ch : s) { + mp[ch]++; + } + int mx = 0; + for(auto p : mp) { + mx = max(p.second, mx); + } + cout << mx - 1 << endl; +} diff --git a/StonesOnTheTable/main_input0.txt b/StonesOnTheTable/main_input0.txt new file mode 100644 index 0000000..5de4d9a --- /dev/null +++ b/StonesOnTheTable/main_input0.txt @@ -0,0 +1,2 @@ +3 +RRG diff --git a/StonesOnTheTable/main_input1.txt b/StonesOnTheTable/main_input1.txt new file mode 100644 index 0000000..f4dad44 --- /dev/null +++ b/StonesOnTheTable/main_input1.txt @@ -0,0 +1,2 @@ +5 +RRRRR diff --git a/StonesOnTheTable/main_input2.txt b/StonesOnTheTable/main_input2.txt new file mode 100644 index 0000000..b7900c6 --- /dev/null +++ b/StonesOnTheTable/main_input2.txt @@ -0,0 +1,2 @@ +4 +BRBG diff --git a/StonesOnTheTable/main_output0.txt b/StonesOnTheTable/main_output0.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/StonesOnTheTable/main_output0.txt @@ -0,0 +1 @@ +1 diff --git a/StonesOnTheTable/main_output1.txt b/StonesOnTheTable/main_output1.txt new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/StonesOnTheTable/main_output1.txt @@ -0,0 +1 @@ +4 diff --git a/StonesOnTheTable/main_output2.txt b/StonesOnTheTable/main_output2.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/StonesOnTheTable/main_output2.txt @@ -0,0 +1 @@ +0 diff --git a/Word/inp b/Word/inp new file mode 100644 index 0000000..e69de29 diff --git a/Word/main b/Word/main new file mode 100755 index 0000000..01dfeb5 Binary files /dev/null and b/Word/main differ diff --git a/Word/main.cpp b/Word/main.cpp new file mode 100644 index 0000000..31937b2 --- /dev/null +++ b/Word/main.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + +string convertLower(string s) { + for(auto &ch : s) { + ch = tolower(ch); + } + return s; +} +string convertUpper(string s) { + for(auto &ch : s) { + ch = toupper(ch); + } + return s; +} + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + int l = 0; + int u = 0; + for(auto ch : s) { + if(islower(ch)) { + l++; + } else { + u++; + } + } + cout << (l < u ? convertUpper(s) : convertLower(s)); +} diff --git a/Word/main_input0.txt b/Word/main_input0.txt new file mode 100644 index 0000000..dcf8e7c --- /dev/null +++ b/Word/main_input0.txt @@ -0,0 +1 @@ +HoUse diff --git a/Word/main_input1.txt b/Word/main_input1.txt new file mode 100644 index 0000000..619b51b --- /dev/null +++ b/Word/main_input1.txt @@ -0,0 +1 @@ +ViP diff --git a/Word/main_input2.txt b/Word/main_input2.txt new file mode 100644 index 0000000..b6751f3 --- /dev/null +++ b/Word/main_input2.txt @@ -0,0 +1 @@ +maTRIx diff --git a/Word/main_output0.txt b/Word/main_output0.txt new file mode 100644 index 0000000..90dde25 --- /dev/null +++ b/Word/main_output0.txt @@ -0,0 +1 @@ +house diff --git a/Word/main_output1.txt b/Word/main_output1.txt new file mode 100644 index 0000000..7077ce5 --- /dev/null +++ b/Word/main_output1.txt @@ -0,0 +1 @@ +VIP diff --git a/Word/main_output2.txt b/Word/main_output2.txt new file mode 100644 index 0000000..f5f6bec --- /dev/null +++ b/Word/main_output2.txt @@ -0,0 +1 @@ +matrix diff --git a/WordCapitalization/inp b/WordCapitalization/inp new file mode 100644 index 0000000..e69de29 diff --git a/WordCapitalization/main b/WordCapitalization/main new file mode 100755 index 0000000..e8a49da Binary files /dev/null and b/WordCapitalization/main differ diff --git a/WordCapitalization/main.cpp b/WordCapitalization/main.cpp new file mode 100644 index 0000000..057e47f --- /dev/null +++ b/WordCapitalization/main.cpp @@ -0,0 +1,12 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + string s; + cin >> s; + s[0] = toupper(s[0]); + cout << s << endl; +} diff --git a/WordCapitalization/main_input0.txt b/WordCapitalization/main_input0.txt new file mode 100644 index 0000000..a032af3 --- /dev/null +++ b/WordCapitalization/main_input0.txt @@ -0,0 +1 @@ +ApPLe diff --git a/WordCapitalization/main_input1.txt b/WordCapitalization/main_input1.txt new file mode 100644 index 0000000..32edabd --- /dev/null +++ b/WordCapitalization/main_input1.txt @@ -0,0 +1 @@ +konjac diff --git a/WordCapitalization/main_output0.txt b/WordCapitalization/main_output0.txt new file mode 100644 index 0000000..a032af3 --- /dev/null +++ b/WordCapitalization/main_output0.txt @@ -0,0 +1 @@ +ApPLe diff --git a/WordCapitalization/main_output1.txt b/WordCapitalization/main_output1.txt new file mode 100644 index 0000000..a0a3cf9 --- /dev/null +++ b/WordCapitalization/main_output1.txt @@ -0,0 +1 @@ +Konjac diff --git a/codechef/MagicalDoors/inp b/codechef/MagicalDoors/inp new file mode 100644 index 0000000..e69de29 diff --git a/codechef/MagicalDoors/main b/codechef/MagicalDoors/main new file mode 100755 index 0000000..e31eb87 Binary files /dev/null and b/codechef/MagicalDoors/main differ diff --git a/codechef/MagicalDoors/main.cpp b/codechef/MagicalDoors/main.cpp new file mode 100644 index 0000000..91b03a6 --- /dev/null +++ b/codechef/MagicalDoors/main.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + string s; + cin >> s; + int ans = 0, x = 0; + for (auto ch : s) { + char c = '0' + (x ^ (ch - '0')); + ans += (c == '0'); + x ^= (c == '0'); + } + cout << ans << '\n'; + } +} diff --git a/codechef/MagicalDoors/main_input0.txt b/codechef/MagicalDoors/main_input0.txt new file mode 100644 index 0000000..438d07b --- /dev/null +++ b/codechef/MagicalDoors/main_input0.txt @@ -0,0 +1,4 @@ +3 +111 +010 +10011 diff --git a/codechef/MagicalDoors/main_output0.txt b/codechef/MagicalDoors/main_output0.txt new file mode 100644 index 0000000..420bd58 --- /dev/null +++ b/codechef/MagicalDoors/main_output0.txt @@ -0,0 +1,3 @@ +0 +3 +2 diff --git a/codechef/PawriMeme/inp b/codechef/PawriMeme/inp new file mode 100644 index 0000000..e69de29 diff --git a/codechef/PawriMeme/main b/codechef/PawriMeme/main new file mode 100755 index 0000000..0f2dcd5 Binary files /dev/null and b/codechef/PawriMeme/main differ diff --git a/codechef/PawriMeme/main.cpp b/codechef/PawriMeme/main.cpp new file mode 100644 index 0000000..1e20964 --- /dev/null +++ b/codechef/PawriMeme/main.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + string s; + cin >> s; + s = regex_replace(s, regex("party"), "pawri"); + cout << s << endl; + } + +} diff --git a/codechef/PawriMeme/main_input0.txt b/codechef/PawriMeme/main_input0.txt new file mode 100644 index 0000000..1cc09ca --- /dev/null +++ b/codechef/PawriMeme/main_input0.txt @@ -0,0 +1,4 @@ +3 +part +partypartiparty +yemaihuyemericarhaiauryahapartyhorahihai diff --git a/codechef/PawriMeme/main_output0.txt b/codechef/PawriMeme/main_output0.txt new file mode 100644 index 0000000..db22163 --- /dev/null +++ b/codechef/PawriMeme/main_output0.txt @@ -0,0 +1,3 @@ +part +pawripartipawri +yemaihuyemericarhaiauryahapawrihorahihai diff --git a/codechef/chefAndTheWildcardMatching/inp b/codechef/chefAndTheWildcardMatching/inp new file mode 100644 index 0000000..e69de29 diff --git a/codechef/chefAndTheWildcardMatching/main b/codechef/chefAndTheWildcardMatching/main new file mode 100755 index 0000000..cffe5c6 Binary files /dev/null and b/codechef/chefAndTheWildcardMatching/main differ diff --git a/codechef/chefAndTheWildcardMatching/main.cpp b/codechef/chefAndTheWildcardMatching/main.cpp new file mode 100644 index 0000000..c00adb4 --- /dev/null +++ b/codechef/chefAndTheWildcardMatching/main.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +int main () { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while(tt--){ + string x; + string y; + cin >> x; + cin >> y; + bool ok = 1; + for(int i = 0; i < x.size(); i++) { + if(x[i] != '?' && y[i] != '?') { + if(x[i] != y[i]) { + ok = 0; + } + } + } + cout << (ok ? "Yes" : "No") << endl; + + } +} diff --git a/codechef/chefAndTheWildcardMatching/main_input0.txt b/codechef/chefAndTheWildcardMatching/main_input0.txt new file mode 100644 index 0000000..c86c473 --- /dev/null +++ b/codechef/chefAndTheWildcardMatching/main_input0.txt @@ -0,0 +1,5 @@ +2 +s?or? +sco?? +stor? +sco?? diff --git a/codechef/chefAndTheWildcardMatching/main_output0.txt b/codechef/chefAndTheWildcardMatching/main_output0.txt new file mode 100644 index 0000000..7ae3bc8 --- /dev/null +++ b/codechef/chefAndTheWildcardMatching/main_output0.txt @@ -0,0 +1,2 @@ +Yes +No -- cgit v1.2.3