Skip to main content
1 of 7
sweerpotato
  • 2.5k
  • 1
  • 19
  • 33

C++14, 1047 bytes

Grotesque solution in C++14:

#include <iostream>
#include <map>
using namespace std;char l='\n';string s[]{"DIGIT ","LATIN CAPITAL LETTER ","LATIN SMALL LETTER "};map<char, string> m{{' ',"SPACE"},{'!',"EXCLAMATION MARK"},{'\"',"QUOTATION MARK"},{'#',"NUMBER SIGN"},{'$',"DOLLAR SIGN"},{'%',"PERCENT SIGN"},{'&',"AMPERSAND"},{'\'',"APOSTROPHE"},{'(',"LEFT PARENTHESIS"},{')',"RIGHT PARENTHESIS"},{'*',"ASTERISK"},{'+',"PLUS SIGN"},{',',"COMMA"},{'-',"HYPHEN-MINUS"},{'.',"FULL STOP"},{'/',"SOLIDUS"},{':',"COLON"},{';',"SEMICOLON"},{'<',"LESS-THAN SIGN"},{'=',"EQUALS SIGN"},{'>',"GREATER-THAN SIGN"},{'?',"QUESTION MARK"},{'@',"COMMERCIAL AT"},{'[',"LEFT SQUARE BRACKET"},{'\\',"REVERSE SOLIDUS"},{']',"RIGHT SQUARE BRACKET"},{'^',"CIRCUMFLEX ACCENT"},{'_',"LOW LINE"},{'`',"GRAVE ACCENT"},{'{',"LEFT CURLY BRACKET"},{'|',"VERTICAL LINE"},{'}',"RIGHT CURLY BRACKET"},{'~',"TILDE"}};int main(){string str;getline(cin,str);for(char c:str){if(islower(c))cout<<s[2]<<(char)(c-32)<<l;else if(isupper(c))cout<<s[1]<<c<<l;else if(isdigit(c))cout<<s[0]<<c<<l;else cout<<m.at(c)<<l;}}
sweerpotato
  • 2.5k
  • 1
  • 19
  • 33