Status update character limit

Report a typo

Hold on! This problem requires knowledge about advanced input using a scanner and if...else control statements you might not have learned yet. If you're feeling adventurous, gear up and give it a shot! If not, you can postpone it and return to it after learning about the above concepts.

Imagine you're developing a social media platform. Users can post status updates, but each status update has a limit of 140 characters.

Given the diverse user base, status updates can include emojis and characters from various languages. Here are a couple of status examples:

I love programming in Go! 😃🚀
我喜欢用Go编程!🐼

Your task is to ensure that each status update adheres to the character limit of 140, considering all types of characters used in the status.

Finally, if the status is within the 140 character limit, you should print the message: "Status is within the 140 character limit" If it exceeds the limit, print: "Status exceeds the 140 character limit"

Tip: You can use the utf8.RuneCountInString() function to count the number of characters in the status.

Sample Input 1:

I love programming in Go! 😃🚀

Sample Output 1:

Status is within the 140 character limit

Sample Input 2:

Starting my #100DaysOfCode with the Go programming language. Day 1 was all about basics. Day 2 will be about runes and strings. Loving this journey so far! 🚀

Sample Output 2:

Status exceeds the 140 character limit
Write a program in Go
package main

import (
"bufio"
"fmt"
"os"
"unicode/utf8"
)

//nolint:gomnd // <-- DO NOT delete this comment!
func main() {
// DO NOT delete or modify the code block below!
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
status := scanner.Text()

// Count the characters in the `status` below:
characterCount := ?

// Check if `characterCount` is within the limit of 140 characters
// And print the appropriate message:
if characterCount <= ? {
fmt.Println(?)
} else {
fmt.Println(?)
}
}
___

Create a free account to access the full topic