about summary refs log tree commit diff
path: root/others/volume1/016.pas
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-28 11:34:35 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2017-02-28 11:34:35 +0700
commitb7e55e6510690093d61f9cc1152e0330e55fe90b (patch)
tree36b48f77d96adaaaefc7728c8a95ca5d4342d653 /others/volume1/016.pas
parent7ebfa64719d4ac86b30075c65f21eafe9097853e (diff)
downloadcp-b7e55e6510690093d61f9cc1152e0330e55fe90b.tar.gz
Update others/volume1
Diffstat (limited to 'others/volume1/016.pas')
-rw-r--r--others/volume1/016.pas24
1 files changed, 24 insertions, 0 deletions
diff --git a/others/volume1/016.pas b/others/volume1/016.pas
new file mode 100644
index 0000000..e50eef0
--- /dev/null
+++ b/others/volume1/016.pas
@@ -0,0 +1,24 @@
+var
+  s, z: ansistring;
+  i, j, k: int16;
+
+begin
+  readln(s);
+  readln(k);
+  setlength(z, length(s));
+  i := 0;
+  j := 0;
+  repeat
+    inc(i);
+    while (j > 0) and
+    (k > 0) and
+    (s[i] > z[j]) do
+    begin
+      dec(j);
+      dec(k)
+    end;
+    inc(j);
+    z[j] := s[i]
+  until i = length(s);
+  writeln(z)
+end.