class
GFG {
static
final
int
arr[] = {
1
,
2
,
3
,
1
,
2
,
3
,
1
,
2
,
3
,
1
,
2
,
3
,
1
,
2
,
3
,
1
,
2
,
3
,
4
,
1
,
2
,
3
,
1
,
2
,
3
,
4
};
public
static
int
countKeyPressed(String str,
int
len)
{
int
count =
0
;
for
(
int
i =
0
; i < len; i++)
count = count + arr[str.charAt(i) -
'a'
];
return
count;
}
public
static
void
main(String[] args)
{
String str =
"abcdef"
;
int
len = str.length();
System.out.print(countKeyPressed(str, len));
}
}