Language: C++

# 2006.cc

#include <iostream>
#include <string>

using namespace std;

string chars[] = {
?? "",
?? ".,!? ",
?? "abc",
?? "def",
?? "ghi",
?? "jkl",
?? "mno",
?? "pqrs",
?? "tuv",
?? "wxyz",
};

int main() {
?? int nnn;
?? cin >> nnn;
?? for (int iii = 0; iii < nnn; ++iii) {
?? ?? string input;
?? ?? cin >> input;
?? ?? int prev = 0, cnt = 0;
?? ?? for (char c : input) {
?? ?? ?? int d = c-'0';
?? ?? ?? if (d == 0) {
?? ?? ?? ?? if (prev != 0) {
?? ?? ?? ?? ??cout << chars[prev][(cnt-1) % chars[prev].size()];
?? ?? ?? ?? }
?? ?? ?? ?? cnt = 0;
?? ?? ?? } else {
?? ?? ?? ?? ++cnt;
?? ?? ?? }
?? ?? ?? prev = d;
?? ?? }
?? ?? cout << endl;
?? }
}

Compiler output:
a.cc:1:3: error: "2006.cc" after # is not a positive integer
    1 | # 2006.cc
      |   ^~~~~~~
a.cc:9:1: error: expected primary-expression before '?' token
    9 | ?? "",
      | ^
a.cc:9:2: error: expected primary-expression before '?' token
    9 | ?? "",
      |  ^
a.cc:10:1: error: expected primary-expression before '?' token
   10 | ?? ".,!? ",
      | ^
a.cc:10:2: error: expected primary-expression before '?' token
   10 | ?? ".,!? ",
      |  ^
a.cc:11:1: error: expected primary-expression before '?' token
   11 | ?? "abc",
      | ^
a.cc:11:2: error: expected primary-expression before '?' token
   11 | ?? "abc",
      |  ^
a.cc:12:1: error: expected primary-expression before '?' token
   12 | ?? "def",
      | ^
a.cc:12:2: error: expected primary-expression before '?' token
   12 | ?? "def",
      |  ^
a.cc:13:1: error: expected primary-expression before '?' token
   13 | ?? "ghi",
      | ^
a.cc:13:2: error: expected primary-expression before '?' token
   13 | ?? "ghi",
      |  ^
a.cc:14:1: error: expected primary-expression before '?' token
   14 | ?? "jkl",
      | ^
a.cc:14:2: error: expected primary-expression before '?' token
   14 | ?? "jkl",
      |  ^
a.cc:15:1: error: expected primary-expression before '?' token
   15 | ?? "mno",
      | ^
a.cc:15:2: error: expected primary-expression before '?' token
   15 | ?? "mno",
      |  ^
a.cc:16:1: error: expected primary-expression before '?' token
   16 | ?? "pqrs",
      | ^
a.cc:16:2: error: expected primary-expression before '?' token
   16 | ?? "pqrs",
      |  ^
a.cc:17:1: error: expected primary-expression before '?' token
   17 | ?? "tuv",
      | ^
a.cc:17:2: error: expected primary-expression before '?' token
   17 | ?? "tuv",
      |  ^
a.cc:18:1: error: expected primary-expression before '?' token
   18 | ?? "wxyz",
      | ^
a.cc:18:2: error: expected primary-expression before '?' token
   18 | ?? "wxyz",
      |  ^
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc:18:11: error: expected ':' before '}' token
   18 | ?? "wxyz",
      |           ^
      |           :
   19 | };
      | ~          
a.cc:19:1: error: expected primary-expression before '}' token
   19 | };
      | ^
a.cc: In function 'int main()':
a.cc:22:1: error: expected primary-expression before '?' token
   22 | ?? int nnn;
      | ^
a.cc:22:2: error: expected primary-expression before '?' token
   22 | ?? int nnn;
      |  ^
a.cc:22:4: error: expected primary-expression before 'int'
   22 | ?? int nnn;
      |    ^~~
a.cc:22:3: error: expected ':' before 'int'
   22 | ?? int nnn;
      |   ^~~~
      |   :
a.cc:22:4: error: expected primary-expression before 'int'
   22 | ?? int nnn;
      |    ^~~
a.cc:22:3: error: expected ':' before 'int'
   22 | ?? int nnn;
      |   ^~~~
      |   :
a.cc:22:4: error: expected primary-expression before 'int'
   22 | ?? int nnn;
      |    ^~~
a.cc:23:1: error: expected primary-expression before '?' token
   23 | ?? cin >> nnn;
      | ^
a.cc:23:2: error: expected primary-expression before '?' token
   23 | ?? cin >> nnn;
      |  ^
a.cc:23:11: error: 'nnn' was not declared in this scope
   23 | ?? cin >> nnn;
      |           ^~~
a.cc:23:14: error: expected ':' before ';' token
   23 | ?? cin >> nnn;
      |              ^
      |              :
a.cc:23:14: error: expected primary-expression before ';' token
a.cc:23:14: error: expected ':' before ';' token
   23 | ?? cin >> nnn;
      |              ^
      |              :
a.cc:23:14: error: expected primary-expression before ';' token
a.cc:24:1: error: expected primary-expression before '?' token
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      | ^
a.cc:24:2: error: expected primary-expression before '?' token
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |  ^
a.cc:24:4: error: expected primary-expression before 'for'
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |    ^~~
a.cc:24:3: error: expected ':' before 'for'
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |   ^~~~
      |   :
a.cc:24:4: error: expected primary-expression before 'for'
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |    ^~~
a.cc:24:3: error: expected ':' before 'for'
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |   ^~~~
      |   :
a.cc:24:4: error: expected primary-expression before 'for'
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |    ^~~
a.cc:24:22: error: 'iii' was not declared in this scope
   24 | ?? for (int iii = 0; iii < nnn; ++iii) {
      |                      ^~~