LOGO100 logo

This challenge was given to WeAreDevelopers by our partners Twilio.

Twilio developers logo

Intro

SMS messages can be encoded in different character encodings to optimize space. The two main types of encodings are:

When an SMS message contains characters outside the GSM-7 character set, it must be encoded in UCS-2. This significantly reduces the number of characters that can fit into a single SMS segment.

Don’t worry, when using Twilio Programmable Messaging, this will be done automatically for you :)

Challenge

Create a function that determines whether an SMS message body can be encoded using GSM-7 or if it requires UCS-2 encoding. The function should also calculate the length of the message in bits for the required encoding.

Write a function that, given a text string representing the body of an SMS, determines:

  1. Whether the message can be encoded using GSM-7 or if it requires UCS-2 encoding.
  2. The length of the message in bits.

Input

Output

Example Input / Output

These tests are available in the dataset.json file to use to create your function.

Helpful Background Knowledge

Submitting your answer

Fill out this form pointing us to your code solution and tell us how you solved the problem. We will pick from the submissions one lucky winner to get a VIP Ticket worth > 1000 Euro for the WeAreDevelopers World Congress in Berlin, Germany 17-19th of July.

Good luck!

Back to all puzzles