makrusak

alphabet

Dec 10th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. void alphabet_make(const char * codeword, char * a) {
  2.   int was[27];
  3.   for (int i=0;i<27;i++) was[i] = 0;
  4.   while ((*codeword)>='a' && (*codeword)<='z') {
  5.     if (!was[(*codeword)-'a']) {
  6.       *a = (*codeword);
  7.       a++;
  8.     }
  9.     was[(*codeword)-'a'] = 1;
  10.     codeword++;
  11.   }
  12.   for (char i='a';i<='z';i++) {
  13.     if (!was[i-'a']) {
  14.       *a = i;
  15.       a++;
  16.     }
  17.   }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment