SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string[s_, n_] :=
  2.   Module[{lista = {}, i = 1, m, j, str, strcar = Characters[s]},
  3.    While[i <= Length[strcar] && i + n - 1 <= Length[strcar], j = 1;
  4.     str = "";
  5.     m = i;
  6.     While[j <= n, str = StringJoin[str, ToString[strcar[[m]]]];
  7.      ++j;
  8.      ++m;];
  9.     AppendTo[lista, str];
  10.     ++i;];
  11.    AppendTo[lista, Reci[n]];
  12.     Return[Flatten[Sort[lista]]];
  13.    ];
  14.    
  15. Reci[b_] :=
  16.   Module[{i, l = {}, ld = IntegerDigits[b]},
  17.    For[i = 1, i <= Length[ld], ++i,
  18.     Switch[Mod[ld[[i]], 10], 0, AppendTo[l, "nula"], 1,
  19.       AppendTo[l, "jedan"], 2, AppendTo[l, "dva"], 3,
  20.       AppendTo[l, "tri"], 4, AppendTo[l, "cetiri"], 5,
  21.       AppendTo[l, "pet"], 6, AppendTo[l, "sest"], 7,
  22.       AppendTo[l, "sedam"], 8, AppendTo[l, "osam"], 9,
  23.       AppendTo[l, "devet"]];];
  24.    Return[l];];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top