# 題目: UVa 10921 - Find the Telephone
# 題目說明
你需要將一串訊息轉換成對應的號碼
INPUT:
每筆測資輸入一個字串 str
OUTPUT:
輸出轉換後的字串
# 解題方法
純粹的條件判斷後輸出即可
# 參考程式碼
#include <iostream> | |
using namespace std;  | |
int main()  | |
{ | |
ios::sync_with_stdio(false);  | |
cin.tie(nullptr);  | |
cout.tie(nullptr);  | |
	string str; | |
while (cin >> str)  | |
	{ | |
for (auto& c : str)  | |
		{ | |
if (c >= 'A' && c <= 'C') cout << 2;  | |
else if (c >= 'D' && c <= 'F') cout << 3;  | |
else if (c >= 'G' && c <= 'I') cout << 4;  | |
else if (c >= 'J' && c <= 'L') cout << 5;  | |
else if (c >= 'M' && c <= 'O') cout << 6;  | |
else if (c >= 'P' && c <= 'S') cout << 7;  | |
else if (c >= 'T' && c <= 'V') cout << 8;  | |
else if (c >= 'W' && c <= 'Z') cout << 9;  | |
else cout << c;  | |
		} | |
cout << "\n";  | |
	} | |
return 0;  | |
} |