What’s Upword?

Let’s call a word an "upword" if its letters are alphabetically sorted, case-insensitively, left to right. By this definition, Begins is an upword because B comes before e, which comes before g, which comes before i, which comes before n, which comes before s. So too is billow (as ll does not violate this definition), but test is not because t does not come before e alphabetically.

Answer the below in upword.txt.

Questions

  1. (1 point.) Is forty an upword?

  2. (1 point.) Is fifty an upword?

  3. (6 points.) Complete the implementation of upword, below, in such a way that it returns true if and only if word is an upword. Return false if word is NULL, if word contains one or more non-alphabetical characters, or if the letters in word are not alphabetically sorted, case-insensitively.

#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>

bool upword(const char *word)
{

Debrief

  1. Which resources, if any, did you find helpful in answering this problem’s questions?

  2. About how long did you spend on this problem’s questions?