#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
int Chop_if(char str[],char ch){
int i = 0;
for (i = 0; str[i] != '\0'; i++);
if (i > 0){
if(str[i - 1] == ch) str[i - 1] = '\0';
}
else return -1;
return 0;
}
int StringToUpper(char str[]){//inplace modify.
int i = 0;
for (i
= 0; str
[i
] != '\0'; i
++) str
[i
] = toupper(str
[i
]); return 0;
}
/*
int PrintValue(char str[]){
int i = 0;
for (i = 0; str[i] != '\0'; i++)printf("%d ",str[i]);
return 0;
}
*/
int main(){
char buff[1024];
while (1){
if (fgets(buff
, 1024, stdin
) == NULL
&& errno
!= EINVAL
) break; Chop_if(buff,'\n');
Chop_if(buff,26);//value of eof at char value.but eof can get int value.
Chop_if(buff,-1);//value of eof at command prompt.this is spooky value??
StringToUpper(buff);
//PrintValue(buff);
}
/*int ch = EOF;
while ((ch = getchar()) != EOF){
ch = toupper(ch);
putc(ch, stdout);
}
*/
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxjdHlwZS5oPgojaW5jbHVkZSA8ZXJybm8uaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKaW50IENob3BfaWYoY2hhciBzdHJbXSxjaGFyIGNoKXsKCWludCBpID0gMDsKCWZvciAoaSA9IDA7IHN0cltpXSAhPSAnXDAnOyBpKyspOwoJaWYgKGkgPiAwKXsKCQlpZihzdHJbaSAtIDFdID09IGNoKSBzdHJbaSAtIDFdID0gJ1wwJzsKCX0KCWVsc2UgcmV0dXJuIC0xOwoJcmV0dXJuIDA7Cn0KaW50IFN0cmluZ1RvVXBwZXIoY2hhciBzdHJbXSl7Ly9pbnBsYWNlIG1vZGlmeS4KCWludCBpID0gMDsKCWZvciAoaSA9IDA7IHN0cltpXSAhPSAnXDAnOyBpKyspIHN0cltpXSA9IHRvdXBwZXIoc3RyW2ldKTsKCXJldHVybiAwOwp9Ci8qCmludCBQcmludFZhbHVlKGNoYXIgc3RyW10pewoJaW50IGkgPSAwOw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