<mosaic.cnfolio.com>
PROGRAM
  1. /*START
  2.     Input Cipher length
  3.         IF length < 2
  4.           THEN
  5.              OUTPUT Error: Cipher must be at least 2 characters
  6.         IF length > 16
  7.           THEN
  8.              OUTPUT Error: Cipher must be no more than 16 characters
  9.         END IF
  10.     Input Cipher
  11.   IF a-z not used
  12.     THEN
  13.                  OUTPUT Error: Please use characters a-z only
  14.               END IF
  15.  
  16.    IF  string length > 256
  17.    THEN
  18.      OUTPUT Error: Text must be no more than 256 characters allowed
  19.               END IF
  20.               IF  string length < 4
  21.    THEN
  22.      OUTPUT Error: Text must be at least 4 characters
  23.               END IF
  24.     IF char=n
  25.       THEN replace with n+1
  26.               END IF
  27.     Continue scanning until end of text,
  28.       WHEN n=cipherlength Make n+1=n
  29.         repeat until end of cipher
  30.           last char in cipher =n, 1st=n+1
  31.  
  32.              
  33.    RETURN           
  34.              
  35.              
  36.              
  37.               */
  38.  
  39. #include <stdio.h>
  40. #include <string.h>
  41. int main(void)
  42. {
  43.    
  44.    
  45.     int i, j, cipherlength, textlength;         
  46.     char cipher[16], text[256], n;
  47.    
  48.     scanf("%d\n" , &cipherlength); /*read cipher length*/
  49.      if (cipherlength>16)
  50.        printf("Error: Cipher must be no more than 16 characters ");
  51.      if (cipherlength<2)
  52.        printf(" Error: Cipher must be at least 2 characters ");
  53.  
  54.     scanf( "%s", &cipher); /*read the cipher*/
  55.     if(cipher[i] <'a' || cipher[i] >'z')
  56.       printf ("Error: Only characters a-z are allowed");
  57.      
  58.      
  59.     scanf("%d\n" , &textlength); /*read text length*/
  60.      if (textlength>256)
  61.        printf("Error: Text must be no more than 256 characters ");
  62.      if (textlength<4)
  63.        printf(" Error: Text must be at least 4 characters ");
  64.  
  65.     scanf( "%s", &text); /*read the text*/
  66.      if(text[i] <'a' || text[i] >'z')
  67.        printf ("Error: Only characters a-z are allowed");
  68.      
  69.     for( i=0;i<cipherlength;i++)
  70.     {
  71.       for (j=i+1;j<cipherlength;j++)
  72.       {
  73.          int temp;
  74.          if (cipher[i] = text[i])
  75.          {
  76.               temp= cipher[i];
  77.               cipher[i]=text[i];
  78.               text[i]=temp;
  79.           }
  80.         printf (" %s");
  81.        }
  82.     }
  83.  
  84.    
  85.    
  86. }