'"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "'"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """ "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """ "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "'"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """'" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " '"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" """" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
Penjelasan
Program ini setara dengan pseudocode seperti ini:
while (cp = (ch = read)) + 1 {
(
(cp -= 65) ? // A
(cp -= 4) ? // E
(cp -= 4) ? // I
(cp -= 6) ? // O
(cp -= 6) ? // U
(cp -= 12) ? // a
(cp -= 4) ? // e
(cp -= 4) ? // i
(cp -= 6) ? // o
(cp - 6) ? // u
0
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
: 1
) ? ((--vs)+4) ? print(ch) : (++vs) : {
print(ch)
vs = 0
}
}
dengan tugas variabel berikut:
0 (unused) (13 bytes)
1 cp ( 4 bytes; occurs 20× in the code)
2 vs ( 7 bytes; occurs 5× in the code)
3 ch (10 bytes; occurs 3× in the code)
Seperti yang Anda lihat, saya menghindari slot variabel 0 karena 0
konstanta yang panjang untuk menulis.
Jadi kami membaca setiap karakter dan menyimpan nilai di keduanya cp
dan ch
. Kami akan memodifikasi cp
tetapi tetap menggunakannya ch
sehingga kami dapat mencetaknya jika perlu. Kami berturut-turut mengurangi angka 65, 4, 4, 6, dll. Dari cp
untuk memeriksa apakah masing-masing dari 10 karakter vokal yang mungkin di ASCII (perhatikan yang terakhir tidak perlu menjadi tugas).
vs
selalu mengandung 3 kurang dari jumlah vokal yang masih diperbolehkan untuk dicetak. Ini dimulai pada 0
, sehingga 3 vokal dapat dicetak. Ketika itu mencapai-3
, kami berhenti mencetak vokal.
Jika kita menemukan non-vokal (termasuk spasi), kita jalankan print(ch)
diikuti olehvs = 0
. Seperti yang mungkin sudah Anda duga, ini akan mengatur ulang penghitung vokal.
Jika kita menemukan vokal , kita mengeksekusi ((--vs)+4) ? print(ch) : (++vs)
. Mari kita uraikan ini:
- pengurangan
vs
;
- jika nilainya sekarang
-4
, kita sudah melangkah terlalu jauh, jadi jangan cetak apa pun, tetapi naikkan vs
kembali -3
sehingga kita akan terus menolak untuk mencetak vokal;
- jika tidak, cetak karakter.
aaYYAAaaaAERGH
.