s = "Go Cats!"
t = "123!?~ k\n foo" #\n is new line character
u = ":)"
RESULT = "Go Cats!"
function ENCODER(TEXT,X)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
ENCODER("Fish",2) = "Hkuj"
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT # D -> L
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT # a -> h
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X) #Call: ENCODER("Data is great!",8)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
function ENCODER(TEXT,X)
//TEXT is the text to encode
//X is the offset
ENC = ""
loop I from 1 to LENGTH of TEXT
CURRENT = TEXT[I]
IF CURRENT IS A LETTER
CHAR_ENC = GET X-th CHAR after CURRENT
ENC += CHAR_ENC
ELSE
ENC += '*'
end loop
return ENC
end function
Iterations | Char Copies |
Mem. Adr. |
---|---|---|
1 | 1 | 2 |
2 | 3 (1+2) | 3 |
3 | 6 (3+3) | 4 |
4 | 10 (6+4) | 5 |
5 | 15 (10+5) | 6 |
Iterations | Char Copies |
Mem. Adr. |
---|---|---|
1 | 1 | 2 |
2 | 3 (1+2) | 3 |
3 | 6 (3+3) | 4 |
4 | 10 (6+4) | 5 |
5 | 15 (10+5) | 6 |
n | (n(n+1))/2 | n + 1 |
Iterations | Char Copies |
Memory Addresses |
---|---|---|
1 | 1 | 2 |
2 | 3 (1+2) | 3 |
3 | 6 (3+3) | 4 |
4 | 10 (6+4) | 5 |
5 | 15 (10+5) | 6 |
n | (n(n+1))/2 | n + 1 |
1,000,000 | 500,000,500,000 | 1,000,001 |