Questions tagged [alphabet]

319 questions
2
votes
3 answers

Possible combinations and convert into alphabet algorithm - Javascript (asked by Facebook)

I am studying algorithm for my next interview, And i found this problem. Which was asked by Facebook Here's the problem. Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. For example,…
Dennis Lee
  • 23
  • 3
2
votes
1 answer

Converting letters into NATO alphabet in MATLAB

I want to write a code in MATLAB that converts a letter into NATO alphabet. Such as the word 'hello' would be re-written as Hotel-Echo-Lima-Lima-Oscar. I have been having some trouble with the code. So far I have the following: function natoText =…
captain1
  • 23
  • 3
2
votes
3 answers

Decompose words into letters with Ruby

In my language there are composite or compound letters, which consists of more than one character, eg "ty", "ny" and even "tty" and "nny". I would like to write a Ruby method (spell) which tokenize words into letters, according to this…
Konstantin
  • 2,983
  • 3
  • 33
  • 55
2
votes
3 answers

Is there a way to sort a String in java alphabetically without putting the String into an Array?

In the code below, I tried to compare char at i with the char at i+1. My understanding is that by using charAt(): I can take the character from the string and treat it as integer and be able to compare two characters. This part of the code works,…
johnny87
  • 21
  • 1
  • 3
2
votes
3 answers

Python Function That Receives Letter, Returns (0-Based) Numerical Position Within Alphabet

I'm trying to create a Python function that receives a letter (a string with only one alphabetic character) and returns the 0-based numerical position of that letter in the alphabet. It should not be case-sensitive, and I can't use import. So…
HappyHands31
  • 4,001
  • 17
  • 59
  • 109
2
votes
1 answer

Python: Ordering list of words with chosen alphabetical order

I am trying to create a program that orders a list of words with my choice of alphabetical order, but I am a little confused with how to begin. For instance, if the chosen alphabetical order was: UVWXYZNOPQRSTHIJKLMABCDEFG Then words would be sorted…
star
  • 179
  • 1
  • 1
  • 6
2
votes
2 answers

Find the number of strings w of length n over the alphabet {a, b, c}

I'm trying to figure out how to calculate the number of all strings of length n such that any substring of length 4 of string w, all three letters a, b, c occur. For example, abbcaabca should be printed when n = 9, but aabbcabac should not be…
brynello
  • 21
  • 3
2
votes
2 answers

Remove all non alphabet characters from a string in C -- possible compiler issue

I'm writing a function in C that will take a string and remove all characters that are not a lowercase alphabetic character. I have this code written so far: void strclean(char* str) { while (*str) { if (!(*str >= 'a' && *str <= 'z')) { …
Chris
  • 87
  • 2
  • 7
2
votes
1 answer

How can I detect any key pressed (numeric, alphabet) event in Android for EditText

I have inherited EditText class an made my custom class, MyEditText. and want to detect key pressed(say 'a', 'b', 'c'... '0', '1', '2'... etc.) event in Android. How? It seems overridden method onKeyDown(int keyCode, KeyEvent event) is called when…
Samir
  • 3,923
  • 9
  • 36
  • 43
2
votes
3 answers

How to apply a dict in python to a string as opposed to a single letter

I am trying to output the alphabetical values of a user entered string, I have created a dict and this process works, but only with one letter. If I try entering more than one letter, it returns a KeyError: (string I entered) If I try creating a…
jonbon
  • 23
  • 5
2
votes
2 answers

PHP Vertical Alphabet Using FOR Cycle

I'm trying to do a script in PHP which will generate a table with vertical alphabet in it. It will simply echo letters from A to Z and when it comes to Z, it will reset and begin from A again. I have a problem with this because I only can repeat…
2
votes
2 answers

Modify program to encrypt both uppercase and lowercase input

I have to write code for a random cipher problem. I have done it, but the program transforms only uppercase or lowercase (depending on what I choose) letters as input. What should I change so that the program transforms both upper and lower-case…
nenko182
  • 41
  • 7
2
votes
2 answers

How to check how many times the letters of the alphabet occur in a text file C++

I want to check how many times the letters of the alphabet are in a text file. #include #include #include #include using namespace std; int main() { char alphabet[]="abcdefghijklmnopqrstuvwxyz"; //char…
2
votes
2 answers

Oracle PL/SQL get the first letter from the name(HUN)

The question sounds easy because only need a substring (name,1,1). But in the Hungarian language there are many letter wich contains multicharacter. eg : CS,DZ,DZS,LY,NY,SZ,TY,ZS IF v_type='by_name' THEN select DISTINCT name into…
SüniÚr
  • 826
  • 1
  • 16
  • 33
2
votes
4 answers

alphabet sort in mysql

I am using the test data "bank" to study mysql on mac. I have a question about the alphabet sort in mysql. I have a example codeselect cust_id,cust_type_cd,city,state,fed_id from customer order by 2 asc; The return shows in column 2, "I" is before…
Kenny
  • 355
  • 1
  • 5
  • 14