const hash = async (str) => {
const msgUint8 = new TextEncoder().encode(str);
const hashBuffer = await crypto.subtle.digest("SHA-512", msgUint8);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, "0")).join("");
return hashHex;
}
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1 = "hello";
string str2 = "hola";
size_t minStrSize = min(str1.size(), str2.size());
size_t maxStrSize = max(str1.size(), str2.size());
string result;
if (str1.size() > str2.size())
{
result = str1;
}
else
{
result = str2;
}
for (size_t i = 0; i < maxStrSize; i++)
{
if (i < minStrSize)
{
if (str1[i] != str2[i])
{
result[i] = '_';
}
}
else
{
result[i] = '_';
}
}
cout << result;
return 0;
}
int square(int x, int y) {
if (x < 0 || y < 0) {
return -1;
}
else
{
return x * y;
}
}
int main(void)
{
int result = square(-2, 5);
if (result == -1) {
cout << "некорректный ввод \n";
}
else {
count << result;
}
}