X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
C++ Basic Data types
Basic Accuracy: 22.6% Submissions: 4531 Points: 1

Given a String S. Find out which of the following basic C++ data types it represents and it's size (in bytes).
The possible data types are:
1. Integer
2. Float
3. Double
4. Character

Example 1:

Input:
S=a
output:
1
Explanation:
The string clearly represents char
and thus the size of char is displayed.

Example 2:

Input
S=98.45685456
Output:
8
Explanation:
The string represents Double.


You don't need to read input or print anything. Your task is to complete the function BasicDataType() which takes String S as input parameter and displays the size (in bytes) of the datatype it represents.

Expected Time Complexity:O(N)
Expected Auxillary Space:O(1)

Constraints:
1<=|S|<=10

We are replacing the old Disqus forum with the new Discussions section given below.