Go to diff to previous submission
#include <stdio.h> #include <strings.h> char alphabet[40] = " ETIANMSURWDKGOHVF_L,PJBXCYZQ.?"; char morses[40][4] = {"@", ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", "..--", ".-.-", "---.", "----"}; int morse_lens[40] = {0,2,4,4,3,1,4,3,4,2,4,3,4,2,2,3,4,4,3,3,1,3,4,3,4,4,4,4,4,4,4}; int main() { char input[1000]; char morse[4000]; int numbers[1000]; while(1) { char c; int i = 0; int morse_len = 0; while(1){ c = input[i]; if(c == 0) break; else if(c == 95) c = 91; else if(c == 44) c = 92; else if(c == 46) c = 93; else if(c == 63) c = 94; c -= 64; morse_len += morse_lens[(int)c]; numbers[i] = morse_lens[(int)c]; i++; } morse[morse_len+1] = 0; i--; int j; int morse_ptr = 0; for(; i >= 0; i--){ c = 0; for(j=0; j<numbers[i]; j++) { c *= 2; if(morse[morse_ptr] == '.'){ c += 1; }else { c += 2; } morse_ptr++; } } } return 0; }
--- c5.s772.cteam004.fs.c.0.fs.c +++ c5.s778.cteam004.fs.c.0.fs.c @@ -52,4 +52,5 @@ if(feof(stdin)) break; } + return 0; }