PifyZ

Rovarspraket en IO

Oct 2nd, 2015
852
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. isConsonant := method(chr,
  2.     "bcdfghjklmnpqrstvwxzBCDFGHJKLMNPQRSTVWXZ" findSeq(chr) isNil not)
  3.  
  4. standardIO := File standardInput()
  5.  
  6. rovarspraket := method(string, output,
  7.     if(string isEmpty,
  8.         output,
  9.  
  10.         firstChar := string at(0) asCharacter
  11.         tailString := string exSlice(1)
  12.  
  13.         rovarspraket(tailString, output ..
  14.             if(isConsonant(firstChar),
  15.                 firstChar .. "o" .. firstChar,
  16.                 firstChar))))
  17.  
  18. main := method(
  19.     "Saisissez une chaine : " println
  20.     input := standardIO readLine
  21.     a := rovarspraket(input, "")
  22.     a println)
  23.  
  24. main
RAW Paste Data