aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/438_esgritura.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/c/438_esgritura.cpp b/c/438_esgritura.cpp
new file mode 100644
index 0000000..c9804d0
--- /dev/null
+++ b/c/438_esgritura.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+
+int esLetra(char letra) {
+ if (letra >= 'a' && letra <= 'z') {
+ return 1;
+ }
+ if (letra >= 'A' && letra <= 'Z') {
+ return 1;
+ }
+ return 0;
+}
+
+int main() {
+ std::string input = "";
+ int letras, excs;
+ //while (std::cin >> input && !std::cin.eof()) {
+ while (std::getline(std::cin, input)) {
+ letras = 0;
+ excs = 0;
+ for (char letra : input) {
+ if (esLetra(letra)) {
+ letras++;
+ }
+ if (letra == '!') {
+ excs++;
+ }
+ }
+ if (excs > letras) {
+ std::cout << "ESGRITO" << std::endl;
+ }
+ else {
+ std::cout << "escrito" << std::endl;
+ }
+ }
+}