Dec 24th, 2017
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program poem;
  2. var
  3.   s: string;
  4.   i: integer;
  5. begin
  6.   writeln ('Enter a spoiled poem (supposed to be typed in Latin)');
  7.   readln (s); //input
  8.   for i := 1 to length (s) do begin //checking each character in the string
  9.     if (ord (s[i]) in [97..122]) then  //if the letter is a lowercase letter then write this letter without changes
  10.       write (s[i])
  11.     else if (ord (s[i]) in [65..90]) then begin //if the letter is a capital letter then we are going to the next line and writing this letter
  12.       writeln;
  13.       write (s[i]);
  14.     end
  15.     else if (ord (s[i]) = 32) then //if the character is space then we write the space
  16.       write (' ');
  17.   end;
  18.   readln;
  19.   readln;
  20. end.
RAW Paste Data