skip to main content
Quorum
Learn
Hour of Code
Reference
Libraries
Download
Bugs
My Projects
Login
Quorum Login
Login
Cancel
Sign up for an account
"Lossy Compression" by Projects
This is a public project. Anyone can view it.
Lossy Compression
Code Area
1
text value = input("Enter a sentence or two, and I'll perform a kind of lossy compression on it.") boolean firstLetter = true integer counter = 0 text vowels = "aeiouAEIOU" number originalSize = value:GetSize() repeat while counter < value:GetSize() text letter = value:GetCharacter(counter) if letter = " " firstLetter = true counter = counter + 1 elseif not firstLetter and vowels:Contains(letter) text previous = "" text remaining = "" if counter > 0 previous = value:GetSubtext(0, counter) end if counter < value:GetSize() - 1 remaining = value:GetSubtext(counter + 1) end value = previous + remaining else firstLetter = false counter = counter + 1 end end output "I kept the first letter of every word, then removed all the other vowels. Here's the result: " output "Compression: " + (100 - 100 * (value:GetSize() / originalSize)) + "%" output value
Build (CTRL+B)
Run (CTRL+R)
Stop Program
Save this Project
Project Name:
Save Project
Cancel
Load a Project
Load Project
Cancel
Save
Load
Embed
Output Area