Waste less time on Facebook — follow Brilliant.
Back to all chapters


Strings are basically "words in computers". As an ordered set of characters, these are the building blocks that allow us to do things from searching filesystems to decrypting ciphers.

Strings: Level 1 Challenges


How many times does the number '7' appear in String a?

String a = "1628261829271628239271982027282927827618227261434335242627282928276272728292918972625252728921011514252431524251524152524254253435241534223392028302029382002929102102929101192928101019298281910101010991929121900101010292991010101029920101092929128919010101929928912910101828272663272818182726256352562615624236252377777215252616252541256625421652392029281710000001010929298282781818288272718821827271288182712819889192919818991292191212272726167172762626216163515251.";
s = 'woimoepzbjvxfafpyfpzgmxugjodtemcjcpoxobfgbsmokkmcdpmawcwwaxhqwabzdlplvteszqgtkamxjkswkpnzpxpudxcmigz'

The given variable 's' is a sequence of random alphabets.

What is length of the longest sub-string of 's' in which the letters occur in alphabetical order.

For example, if s = 'azcbobobegghakl', then the longest sub-string in which letters occur in alphabetical order is 'beggh' with length 5.

There are 26 letters, A to Z. The inverse code, replaces A as Z, B as Y, C as X .... and Z as A.

Use the inverse code to translate the message in the image.


Problem Loading...

Note Loading...

Set Loading...