-
Notifications
You must be signed in to change notification settings - Fork 0
/
alpha.sol
50 lines (40 loc) · 1.11 KB
/
alpha.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract alpha{
mapping(uint => string) public counter;
constructor(){
counter[1] = "A";
counter[2] = "B";
counter[3] = "C";
counter[4] = "D";
counter[5] = "E";
counter[6] = "F";
counter[7] = "G";
counter[8] = "H";
counter[9] = "I";
counter[10] = "J";
counter[11] = "K";
counter[12] = "L";
counter[13] = "M";
counter[14] = "N";
counter[15] = "O";
counter[16] = "P";
counter[17] = "Q";
counter[18] = "R";
counter[19] = "S";
counter[20] = "T";
counter[21] = "U";
counter[22] = "V";
counter[23] = "W";
counter[24] = "X";
counter[25] = "Y";
counter[26] = "Z";
}
function turnToAlpha(uint[] memory numbers) public view returns(string memory){
string memory finalWord = "";
for(uint i=0;i<numbers.length;i++){
finalWord = string.concat(finalWord, counter[numbers[i]]);
}
return finalWord;
}
}