/*
* hello.c
*
* print "Hello World!" on standard output device (console).
*
*/
#include <stdio.h>
void toUpperCase(char *p);
void toLowerCase(char *p);
int main()
{
char mes1[] = "Hello";
char mes2[] = "World!";
toUpperCase(mes1);
toLowerCase(mes2);
printf("%s %s\n", mes1
, mes2
);
return 0;
}
void toUpperCase(char *p)
{
for ( ; *p != '\0'; p++) {
if (('a' <= *p) && (*p <= 'z')) {
*p += 'A' - 'a';
}
}
}
void toLowerCase(char *p)
{
for ( ; *p != '\0'; p++) {
if (('A' <= *p) && (*p <= 'Z')) {
*p += 'a' - 'A';
}
}
}
LyogCiAqIGhlbGxvLmMKICogCiAqIHByaW50ICJIZWxsbyBXb3JsZCEiIG9uIHN0YW5kYXJkIG91dHB1dCBkZXZpY2UgKGNvbnNvbGUpLgogKiAKICovCgojaW5jbHVkZSA8c3RkaW8uaD4KCnZvaWQgdG9VcHBlckNhc2UoY2hhciAqcCk7CnZvaWQgdG9Mb3dlckNhc2UoY2hhciAqcCk7CgppbnQgbWFpbigpCnsKICAgIGNoYXIgbWVzMVtdID0gIkhlbGxvIjsKICAgIGNoYXIgbWVzMltdID0gIldvcmxkISI7CiAgICAKICAgIHRvVXBwZXJDYXNlKG1lczEpOwogICAgdG9Mb3dlckNhc2UobWVzMik7CiAgICAKICAgIHByaW50ZigiJXMgJXNcbiIsIG1lczEsIG1lczIpOwogICAgCiAgICByZXR1cm4gMDsKfQoKdm9pZCB0b1VwcGVyQ2FzZShjaGFyICpwKQp7CiAgICBmb3IgKCA7ICpwICE9ICdcMCc7IHArKykgewogICAgICAgIGlmICgoJ2EnIDw9ICpwKSAmJiAoKnAgPD0gJ3onKSkgewogICAgICAgICAgICAqcCArPSAnQScgLSAnYSc7CiAgICAgICAgfQogICAgfQp9Cgp2b2lkIHRvTG93ZXJDYXNlKGNoYXIgKnApCnsKICAgIGZvciAoIDsgKnAgIT0gJ1wwJzsgcCsrKSB7CiAgICAgICAgaWYgKCgnQScgPD0gKnApICYmICgqcCA8PSAnWicpKSB7CiAgICAgICAgICAgICpwICs9ICdhJyAtICdBJzsKICAgICAgICB9CiAgICB9Cn0K