All SolutionsAll Solutions

🏚️

Halfway House

Week 26, 2026

Python - Ord() | BMC | Python Solutions

def split_msg_in_twos(msg: str) -> list[str]: ans: list[str] ans = [] for i in range(0, len(msg), 2): ans.append(msg[i:i+2]) return ans def decode(msg: list[str]) -> str: ans: str ans = "" for chars in msg: ans += chr(ord(chars[0]) + ord(chars[1])) return ans # main msg = "'91#08A$ B*$E>/45<8,G $K$B 1</J &F!@=1-:P%?\"(?@% #J05*7)E,G B2!G8- 3918C*63\"R6= %J/7 -@8A #TN!D.K!*:2. <B *\"%P!C3DD%C$ 2%81A33A52-8H&!RK)C\"/:3;" msg = msg.split() for m in msg: print(decode(split_msg_in_twos(m)), end=" ")

Can't get the thing to insert a space char ? | Draw6 | C++ Solutions

#include "allheaders.hpp" #include "main.hpp" using namespace std; //------------------------------------challenge specific variables and functions char GetASCIIvalue(char a, char b); vector<char> challenge26; //------------------------------------------------------------------------------ int main(int argc, char* argv[]) { try { ifstream infile("chfile.txt"); if(!infile) { cerr << "Error opening file.\n"; return 1; } char ch; while(infile.get(ch)) { challenge26.push_back(ch); } infile.close(); int sz = challenge26.size(); string str; for(int i = 0; i < sz; i++) { if( challenge26[i] != '\n') { char a = challenge26[i]; char b = challenge26[i+1]; str += GetASCIIvalue(a,b); } } string result; for (size_t i = 0; i < str.length(); ++i) { if (i % 2 == 0) { result += str[i]; } } cout << result << endl; return(0); }// end of try catch (const runtime_error& exception) { std::cout << "Msg: " << exception.what() << "\n"; } cout << "\n"; return 0; } //---------------------------------------------------------------------------- char GetASCIIvalue(char a, char b) { char value; if( a == '\n' || b == '\n') { value = '\032'; } else { int val1 = static_cast <int>(a); int val2 = static_cast <int>(b); int val3 = a + b; value = static_cast <char>(val3); } return value; }

Split by spaces and read pairs | greenya | Odin Solutions

package main import "core:fmt" import "core:strings" INPUT :: `'91#08A$ B*$E>/45<8,G $K$B 1</J &F!@=1-:P%?"(?@% #J05*7)E,G B2!G8- 3918C*63"R6= %J/7 -@8A #TN!D.K!*:2. <B *"%P!C3DD%C$ 2%81A33A52-8H&!RK)C"/:3;` main :: proc () { fmt.println(decode(INPUT)) } decode :: proc (s: string, allocator := context.allocator) -> string { s := s sb := strings.builder_make(allocator) for part in strings.split_iterator(&s, " ") { assert(len(part)%2==0) if strings.builder_len(sb) > 0 { strings.write_byte(&sb, ' ') } for i:=0; i<len(part); i+=2 { strings.write_byte(&sb, part[i] + part[i+1]) } } return strings.to_string(sb) }