Case and spaces
bada(s) ("big") makes text uppercase and chhota(s) ("small") lowercase. saaf(s) ("clean") removes spaces from both ends — perfect for tidying what a user typed. lambai(s) counts characters.
Split and join
kaato(text, separator) ("cut") splits text into a list wherever the separator appears. milao(list, separator) ("mix") does the reverse and glues a list into one string. Together they let you rebuild text in a new shape.
Expected output
Press Run to try it
[chai, samosa, jalebi]3 itemschai + samosa + jalebi
Search, replace and slice
shamil(text, part) checks whether text contains a part. khojo(text, part) returns where it starts, or -1. badlo(text, old, new) replaces every match. tukda(text, start, end) cuts characters from start up to, but not including, end. Character positions start at 0, just like list indexes.
Reverse it
ulta(text) ("reversed") returns the text backwards. A word that reads the same both ways is a palindrome, and checking one is now a single comparison.
Practice exercise
Turn the messy input " aaj ka DIN " into the title AAJ KA DIN: trim it, split on spaces, keep only non-empty words, and join with single spaces in uppercase. Print the result.
Expected output
AAJ KA DIN
Show solution
rakho text = " aaj ka DIN ";
rakho words = kaato(saaf(text), " ");
rakho achhe = [];
chalo (rakho i = 0; i < lambai(words); i = i + 1) {
agar (words[i] != "") {
jodo(achhe, words[i]);
}
}
bol(bada(milao(achhe, " ")));