Link Search Menu Expand Document

Type of a Sentence

For a given sentence, print its type based on the following rules:

  • Interrogative sentences end with a question mark
  • Exclamatory sentences end with an exclamation mark
  • All other sentences are considered Declarative.

E.g. for the following text: I ate a snail. the program should output Declarative, whereas for this sentence I ate a snail! the output should be Exclamatory