57592023-09-18 18:15:34norbertvidaMorze (60 pont)cpp11Elfogadva 60/603ms3508 KiB
#include <stdio.h>
#include <string.h>
#define calc(a, b, c, d, e) ((a - 45) << 4 | (b - 45) << 3 | (c - 45) << 2 | (d - 45) << 1 | (e - 45))
int main() {
    int nums[32];
    nums[calc('-','-','-','-','-')] = 0;
    nums[calc('.','-','-','-','-')] = 1;
    nums[calc('.','.','-','-','-')] = 2;
    nums[calc('.','.','.','-','-')] = 3;
    nums[calc('.','.','.','.','-')] = 4;
    nums[calc('.','.','.','.','.')] = 5;
    nums[calc('-','.','.','.','.')] = 6;
    nums[calc('-','-','.','.','.')] = 7;
    nums[calc('-','-','-','.','.')] = 8;
    nums[calc('-','-','-','-','.')] = 9;
    char in[1001];
    scanf("%s", in);
    int inl = strlen(in);
    for(int i = 0, t; i < inl; i += 5) {
        printf("%d", nums[calc(in[i], in[i + 1], in[i + 2], in[i + 3], in[i + 4])]);
    }
    printf("\n");
}