#include <iostream>
#include <string>
#include <unordered_map>
#include <sstream>
#include <vector>
using namespace std;
int main() {
unordered_map<string, char> morseToDigit = {
{"-----", '0'},
{".----", '1'},
{"..---", '2'},
{"...--", '3'},
{"....-", '4'},
{".....", '5'},
{"-....", '6'},
{"--...", '7'},
{"---..", '8'},
{"----.", '9'}
};
string input;
getline(cin, input);
istringstream iss(input);
string morseCode;
string result;
while (iss >> morseCode) {
if (morseToDigit.find(morseCode) != morseToDigit.end()) {
result += morseToDigit[morseCode];
}
}
cout << result << endl;
return 0;
}
#include<bits/stdc++.h>
using namespace std; int main() { unordered_map<string, char> morseToDigit = { {"-----", '0'}, {".----", '1'}, {"..---", '2'}, {"...--", '3'}, {"....-", '4'}, {".....", '5'}, {"-....", '6'}, {"--...", '7'}, {"---..", '8'}, {"----.", '9'} }; string input; getline(cin, input); istringstream iss(input); string morseCode; string result; while (iss >> morseCode) { if (morseToDigit.find(morseCode) != morseToDigit.end()) { result += morseToDigit[morseCode]; } } cout << result << endl; return 0; }
#include<bits/stdc++.h>
using namespace std; int main() { unordered_map<string, char> morseToDigit = { {"-----", '0'}, {".----", '1'}, {"..---", '2'}, {"...--", '3'}, {"....-", '4'}, {".....", '5'}, {"-....", '6'}, {"--...", '7'}, {"---..", '8'}, {"----.", '9'} }; string input; getline(cin, input); istringstream iss(input); string morseCode; string result; while (iss >> morseCode) { if (morseToDigit.find(morseCode) != morseToDigit.end()) { result += morseToDigit[morseCode]; } } cout << result << endl; return 0; }TOO EZ QUESTION YOU USE AI LOL
How to you know huh?