fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. char student[27] = {0};
  6. char real[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  7. char corection[26] = {0};
  8. int istudent = 0, ireal = 0, icorection = 0;
  9.  
  10. for(istudent = 0; istudent<26 ; istudent++){
  11. scanf("%c", &student[istudent]);
  12.  
  13. if(student[istudent]=='$')
  14. break;
  15. }
  16.  
  17. for(istudent = ireal = icorection = 0; (istudent < 26) && (ireal < 26); icorection++)
  18. {
  19.  
  20. if (student[istudent] == real[ireal])
  21. {
  22. istudent++;
  23. ireal++;
  24. corection[icorection] = student[istudent-1];
  25.  
  26. }
  27. else if (student[istudent] != real[ireal])
  28. {
  29. ireal++;
  30. corection[icorection] = (real[ireal-1] - 32);
  31. }
  32.  
  33. }
  34. // print results
  35. int k;
  36.  
  37. for(k=0;k<26;k++)
  38. printf("%c", corection[k]);
  39. return 0;
  40. }
Success #stdin #stdout 0s 9416KB
stdin
abcdz$
stdout
abcdEFGHIJKLMNOPQRSTUVWXYz